![]() |
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 |
| extracting text and reusing the text to rename file | JohnDS | UNIX for Dummies Questions & Answers | 7 | 02-05-2009 03:55 AM |
| Extracting specific text from a file | rahulkav | Shell Programming and Scripting | 8 | 10-22-2008 10:34 AM |
| extracting a set of strings from a text file | Deanne | Shell Programming and Scripting | 2 | 09-20-2007 11:31 PM |
| Extracting information from text fields. | spindoctor | UNIX for Dummies Questions & Answers | 24 | 06-09-2007 01:17 PM |
| extracting last paragraph from a text | uvrakesh | Shell Programming and Scripting | 1 | 04-24-2007 05:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Extracting Text
Hi,
I have a file like that No seq Text 269091 123443124 how are slkslks, serial no is 042890000 and pincode is 090001223433454 269091 123443124 how are slkslks, Sr/no is 0428901 and 14 digits are is 040001223433451. I want to extract serial no or Sr and pincode or 14 digits. Both occur in the file. outup should be like that 042890000 090001223433454 0428901 040001223433451 Thanks in advance. |
|
||||
|
Assuming above is 2 records (i.e. not 4 records):
269091 123443124 how are slkslks, serial no is 042890000 and pincode is 090001223433454 269091 123443124 how are slkslks, Sr/no is 0428901 and 14 digits are is 040001223433451 Code:
nawk -F" is " ' { split($2,A," "); split($3,B," "); print A[1] " " B[1] } ' file
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|