Need to extract 7 characters immediately after text '19' from a large file.

Hi All!!

I have a large file containing millions of record. My purpose is to extract 7 characters immediately after text '19' from this file (including text '19') and save the result in new file.

So, my OUTPUT would be as under :

191234561
194567894
192789005
198839408
and so on.....

Please help. Thanks in advance

echo "191234561"| cut -c3-
1234561

Hi zaxxon!

Thanks for you quick response. But what i want is to search for '19' in input file and then save the seven character adjacent to text '19' in input file to output file.

Something like this?

awk '/^19/{print substr($1,1,9)}' file > outfile

Regards

Hi Franklin!

Thanks for your sir!

Above command is searching only when line starts with '19'. Please tell me how can i manipulate it to work even when '19' is present anywhere inside the line.

Thanks a lot for you help.

 awk '/19/{print substr($1,1,9)}' file > outfile

Regards

Thanks Franklin!

But this is printing 7 character before text '19' and i wan to print 7 character after '19'. Please help

Thanks

awk 'match($0,"19"){print substr($0,RSTART+2,7)}' file > outfile

Regards