You have created a file project.txt, containing a list of file names for a proje
ID: 3769308 • Letter: Y
Question
You have created a file project.txt, containing a list of file names for a project, one file name per line, for example:
You would like to obtain a listing of just the base names of those files, with the final extension stripped away, for example:
What sed command would do the job?
sed -e 's/[.][^.]*$/./' project.txt
sed -e 's/.[^.]*$/./' < project.txt
sed -e 's/.*.[^.]*$/./' < project.txt
sed -e 's/^.[^.]*$/./' < project.txt
sed -e 's/.[a-z]*/./' < project.txt
sed -e 's/[.][^.]*$/./' project.txt
sed -e 's/.[^.]*$/./' < project.txt
sed -e 's/.*.[^.]*$/./' < project.txt
sed -e 's/^.[^.]*$/./' < project.txt
sed -e 's/.[a-z]*/./' < project.txt
Explanation / Answer
using shell we cann add the sed script to the commandline
This corresponds to the fourth element of the table
sed -e 's/^.[^.]*$/./' <project .txt
this will show the names of all the files whether they are hidden or not without their extensions/-> beginning
-> for ending
^- shows only the first names of the file.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.