The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: Extrating Data
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-02-2006
vino's Avatar
vino vino is offline
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,710
Quote:
Originally Posted by irehman
I'm new to unix scripting

I have a file with thousands of rows, each row starts with a transaction code such as H1012, H1013, T7890, M678N. Each Transaction code is always 5 letter long. I need to extract all the rows starting from U1012 and write the output to another file.

How do I do that?

Thanks in Advance
Two interpretations for the above questions.

Extract all rows starting from txn code U1012 till end of file.

Code:
sed -n -e '/^U1012/,$p' input.txt > output.txt
Or, get all txn rows like U1012, U1013 et al. i.e. all U txn rows.

Code:
sed -n -e '/^U.*/p' input.txt > output.txt
Reply With Quote