The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-27-2009
nareshk nareshk is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
Fetch the rows with match string on a fixed lenth text file - NO delimiters

Hi

I am trying to fetch the rows with match string "0000001234"

Input file looks like below:

09 0 XXX 0000001234 Z 1
09 0 XXX 0000001234 Z 1
09 0 XXX 0000001234 Z 1
09 0 XXX 0000001234 Z 1
09 0 XXX 0000001234 Z 1
09 0 XXX 0000001234 Z 1

here the scenario is like we need to fetch the rows with match string "0000001234" and print the lines in a separate file ...

i tried with grep command by grep ^09 file > output file it works fine only when the string is starts first.

Please can some one help me how we can do this ...