![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pattern matching in file and then display 10 lines above every time | namishtiwari | Shell Programming and Scripting | 30 | 04-13-2009 11:40 AM |
| pattern matching over more lines | trek | Shell Programming and Scripting | 3 | 04-22-2008 06:37 AM |
| Script to find file name for non matching pattern | sujoy101 | Shell Programming and Scripting | 5 | 03-31-2008 09:10 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 03:41 PM |
| getting file words as pattern matching | arunkumar_mca | High Level Programming | 5 | 05-31-2005 03:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Reading lines in a file matching a pattern
Hi,
I need to redirect the lines in a file to a different file if the character starting from 2 to 6 in the line are numerical [0-9]. Please let me know if anyone have any script to do this. Thanks, Ranjit |
|
||||
|
awk
Hi,
First of all, i would like to give you a suggestion that while you are here. try to give a example about your thread. Then it will be easy for others to understand your requirements and give you the suitable solution. I assume your requirements as follow: input: Code:
a23456 line is the first line abcd line is the second line 12345644 line is the third line sadfjkl line is the forth line Code:
a23456 line is the first line 12345644 line is the third line awk '{ if (substr($0,2,5)+0==substr($0,2,5)) }' firstfile > secondfile |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|