1832988 Members
4304 Online
110048 Solutions
New Discussion

More sed help.

 
SOLVED
Go to solution
Greg Stark_1
Frequent Advisor

More sed help.

Alright all you sed guru's out there, I have script that I need some help with. What I want to do is look at file, find the first occurence of a pattern, "Users on", and send that line, and everything above it to an outpout file.

Example before sed:
root:\cat infile
Test system
check users
Users on
jdoe
bclinton
Aborting

Example after sed:
root:\cat outfile
Test system
check users
Users on
1 REPLY 1
James R. Ferguson
Acclaimed Contributor
Solution

Re: More sed help.

Hi Greg:

Given the file as shown, call it "myfile", do:

# sed '/Users on/q' myfile

...JRF...