I have a text file ("input.txt") with the following lines in it:
I have created the following two filters:
I run these filters and receive the following output:
These scripts run perfectly on line 4. The rest of the lines...not so much. I do not want lines 1-3 and 5-7 to show up. I only want line 4 to be printed.
Can some gnarly ass ("King of all Stream Editors") help me out with this? If the two filters (above) can be written more efficiently, I wouldn't mind that either.
HELP!
Code:
This is Line 1
This is Line 2
This is Line 3
THREE PEOPLE CAN KEEP A SECRET IF TWO ARE DEAD
This is Line 5
This is Line 6
This is Line 7
I have created the following two filters:
Code:
sed 's/^.*THREE //g;s/ IF.*$//g' < input.txt
awk '{sub(/.*THREE /,"");sub(/ IF.*/,"");print;}' < input.txt
I run these filters and receive the following output:
Code:
This is Line 1
This is Line 2
This is Line 3
PEOPLE CAN KEEP A SECRET
Tnis is Line 5
This is Line 6
This is Line 7
These scripts run perfectly on line 4. The rest of the lines...not so much. I do not want lines 1-3 and 5-7 to show up. I only want line 4 to be printed.
Can some gnarly ass ("King of all Stream Editors") help me out with this? If the two filters (above) can be written more efficiently, I wouldn't mind that either.
HELP!