![]() |
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 |
| nawk-how count the number of occurances of a pattern, when don't know the pattern | cyber111 | Shell Programming and Scripting | 2 | 05-11-2008 03:00 AM |
| Find a pattern and replace using sed. | maridhasan | Shell Programming and Scripting | 5 | 09-18-2007 01:43 AM |
| Search for a Pattern and Replace | sbasetty | Shell Programming and Scripting | 6 | 10-19-2006 12:35 PM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 03:41 PM |
| how to search the pattern | vasikaran | UNIX for Dummies Questions & Answers | 2 | 06-30-2005 04:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
SED Search Pattern and Replace with the Pattern
Hello All,
I have a string "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031", and I just want to extract LLSV1, but I dont get the expected result when using the sed command below. # echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" | awk '{print $4}' | sed 's/_\(LLSV[a-zA-Z0-9]\)_/\1/g' Can you help me with the sed command how can I search a pattern and replace the whole word with the patter? racbern |
|
||||
|
If pattern is going to be the same then use this
echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" |cut -d ' ' -f4|cut -d _ -f2 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|