csaha
February 21, 2006, 1:27am
1
One of my outout is like this as shown below. How can I grep only the lines after the line "Affected files ...". No of lines after the line "Affected files ..." may vary.
$ cat file_A
Change 149133 by csaha@test_depo_csaha on 2006/02/08 01:40:57 *pending*
This is to test change \#
Affected files ...
... //depot/users/csaha/chirantan/R&D1.doc#1 edit
... //depot/users/csaha/my-scripts/ecmsbuild.sh#2 edit
... //depot/users/csaha/my-scripts/eta noster gora.txt#1 add
... //depot/users/csaha/my-scripts/fs-dtls.sh#2 edit
... //depot/users/csaha/my-scripts/fs_usage_monitor.sh#2 edit
... //depot/users/csaha/my-scripts/server_info.sh#2 edit
vino
February 21, 2006, 1:32am
2
You could do this.
sed -n -e '/Affected files/,$p' | grep needle
It will gather all lines from "Affected files" till end of file.
csaha
February 21, 2006, 2:16am
3
Thanks for the code dude
Only this was enough
$ cat file_A | sed -n -e '/Affected files/,$p'
Affected files ...
... //depot/users/csaha/chirantan/R&D1.doc#1 edit
... //depot/users/csaha/my-scripts/ecmsbuild.sh#2 edit
... //depot/users/csaha/my-scripts/eta noster gora.txt#1 add
... //depot/users/csaha/my-scripts/fs-dtls.sh#2 edit
... //depot/users/csaha/my-scripts/fs_usage_monitor.sh#2 edit
... //depot/users/csaha/my-scripts/server_info.sh#2 edit
vino
February 21, 2006, 2:17am
4
cat file_A | sed -n -e '/Affected files/,$p'
That is a UUOC
sed -n -e '/Affected files/,$p' file_A