Find the rows that contain abcde from file /etc/testfil…

Find the rows that contain abcde from file /etc/testfile, and write it to the file/tmp/testfile, and the sequence
is requested as the same as /etc/testfile.

Find the rows that contain abcde from file /etc/testfile, and write it to the file/tmp/testfile, and the sequence
is requested as the same as /etc/testfile.

Answer: See the explanation

Explanation:
# cat /etc/testfile | while read line;
do
echo $line | grep abcde | tee -a /tmp/testfile
done
OR
grep `abcde’ /etc/testfile > /tmp/testfile



Leave a Reply 0

Your email address will not be published. Required fields are marked *