I have a file which has 7375 lines and i need to add ls -l to the beginning of every line. How could i do this with sed?
Asked
Active
Viewed 184 times
-1
Weylyn Savan
- 553
- 3
- 8
- 18
-
2`sed '/^/ls -l /' my_file` ? – Stephen Rauch Aug 11 '17 at 13:16
1 Answers
1
Search for the beginning of a line with ^ and replace it with your desired string ls -l with sed's s/search/replace/
Your command would look like:
$ sed 's/^/ls -l /' file
John Goofy
- 911
- 1
- 6
- 17