Issue
I want to append a string on the every line from the grep result.
For example, this command will return several lines:
ls -a | grep "filename"
filename1
filename2
filename3
filename4
How can I append a string test
on each return line using a single command? So that I get this output:
test filename1
test filename2
test filename3
test filename4
Solution
You can do this:
ls -a | grep "filename" | perl -ne 'print "test $_"'
Answered By - ErikR Answer Checked By - Pedro (WPSolving Volunteer)