![]() |
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 |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 08-06-2008 08:12 PM |
| how to? launch command with string of command line options | TinCanFury | Shell Programming and Scripting | 5 | 04-28-2008 06:06 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | SuSE | 5 | 07-30-2007 08:26 AM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | HP-UX | 1 | 10-16-2006 04:16 PM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | Shell Programming and Scripting | 0 | 09-19-2006 09:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
help with Sed Command
Hi All,
I am trying to create a script using sed to search for a . and _ on a variable, and if it finds match, remove any value after a . or _. For Example : H.3 --> New Value should be H R2K_CL --> New value should be R2K Here's the command that I used: # echo $var | sed 's/[._].*$//' But my problem is when the variable has several . or _ It should only remove the value after the last . or _. For Example: C4.1.2 --> New Value should be C4.1 How will I update my sed command to just remove the value after the last occurrence of a . or _? Thanks, racbern |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|