![]() |
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 |
| Extract .tgz files that only contain a pattern | percivalwcy | UNIX for Dummies Questions & Answers | 12 | 08-18-2008 02:19 AM |
| awk: need to extract a line before a pattern | npn35 | Shell Programming and Scripting | 17 | 06-29-2008 10:38 PM |
| Extract Pattern Sequence | jaganadh | Shell Programming and Scripting | 5 | 12-10-2007 11:06 AM |
| Extract the Pattern | aajan | UNIX for Dummies Questions & Answers | 6 | 08-08-2007 04:47 AM |
| Please help! Sed extract a pattern | zhen | Shell Programming and Scripting | 11 | 09-18-2006 12:36 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
extract a string after a pattern using sed
I have a very large file and each line has a pattern and it is not position specific. I need to extract the string after the pattern
****MI* is the pattern in the red color 12 digit number is the sting value in the green color and it ends with ~ e.g. 5~NM1*IL*1*ARROYO*JESUS****MI*010001990802~N3*11300 WOOD ST*APT J~ ***15~NM1*IL*1*HILARIO VALENCIA*ISMAEL****MI*010002846144~N3*9242 ***15~NM1*IL*1*SALDANA*NICOLASA****MI*010000817902~N3*12348 N HIGH *P*18****6***15~NM1*IL*1*CARRILLO*OSCAR****MI*010002858693~N3*8000 5~NM1*IL*1*MENDOZA*KIARA****MI*010001985968~N3*9119 DECOY CT~N4*LA *18****6***15~NM1*IL*1*NAVARRETTE*JADE****MI*010001670093~N3*5075 5~NM1*IL*1*GARCIA*FERNANDO****MI*010001922131~N3*5811 KAREN PL~N4* *6***15~NM1*IL*1*RATTERO*JAQUELINE****MI*010001773030~N3*253 E MCK 18****6***15~NM1*IL*1*ROSAS*ALONDRA****MI*010001731780~N3*1326 1/2 18****6***15~NM1*IL*1*RAMOS-HERNANDEZ*ROSALINDA****MI*010002883575 18****6***15~NM1*IL*1*YU*LARRY****MI*010001974928~N3*2817 WENDELL 18****6***15~NM1*IL*1*YU*LARRY****MI*010001974928~N3*2817 WENDELL ***15~NM1*IL*1*SOTO*RAUL****MI*010001882921~N3*1318 NORTH HELM AVE ***15~NM1*IL*1*LINARES*LUIS****MI*010000877519~N3*3489 E MCKINLEY **6***15~NM1*IL*1*CALDERON*GERARDO****MI*010000744686~N3*1522 AMAD 010001974928~N3*2817 WENDELL AVE~N4*RICHMOND*CA*948041361~DMG*D8*1 cat c2.txt | tr '~' '\n' | grep '****MI' I am not getting desired result Pls. help Thanks |
|
|||||
|
please post in the appropriate forum for your question! moved to shell programming. this is also a dup of Grep & print
thread closed! Last edited by DukeNuke2; 10-11-2008 at 03:54 PM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|