![]() |
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 problem | namishtiwari | Shell Programming and Scripting | 2 | 05-23-2008 07:33 AM |
| Pattern Matching in UNIX | maxmave | Shell Programming and Scripting | 2 | 05-14-2008 03:21 PM |
| problem with CASE pattern matching | gummysweets | Shell Programming and Scripting | 2 | 03-18-2008 11:30 AM |
| ksh pattern matching | ripat | Shell Programming and Scripting | 5 | 02-10-2008 04:44 PM |
| pattern matching problem | rein | Shell Programming and Scripting | 8 | 10-26-2007 11:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Pattern Matching problem in UNIX
Hello All,
I need help I have a problem in searching the pattern in a file let us say the file contains the below lines line 1 USING *'/FILE/FOLDER/RETURN') ................. ................. line 4 USING *'/FILE/FOLDER/6kdat1') line 5 USING *'/FILE/FOLDER/4kdat1') ................. ................. line 8 USING *'/FILE/FOLDER/TMPSPACE') ................. line 9 USING *FILE '/FILE/FOLDER/TEST'100004) ................. line 11 USING *FILE '/FILE/FOLDER/TEST'2000) ................. ................. line 14 USING *FILE '/FILE/FOLDER/TEST'2000) ................. line 16 USING *FILE '/FILE/FOLDER/TEST'3000) Actually i want to search a pattern in the file, lets say USING *, if the pattern is found then get each line for example the pattern is found in the following lines line 1,4,5,8,9,11,14,16 Then get each line and go to the end of the line and check whether the line ends with a number say here in line 9,11,14,16 it ends with a number but with ) as the last character. and replace the number with another input string. Actually i tried lot of options in PERL but could not get a proper solution for this. Can anyone please help in this regard. Thanks Rahul |
|
||||
|
Code:
perl -pe 's/(.* USING .*\D)\d+\)/$1 something)/' file It's not so much a Perl question as a regex question, really. |
![]() |
| Bookmarks |
| Tags |
| perl, perl regex, regex |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|