![]() |
|
|
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 |
| counting the lines matching a pattern, in between two pattern, and generate a tab | d.chauliac | Shell Programming and Scripting | 4 | 03-19-2009 01:30 PM |
| pattern matching | adityamahi | Shell Programming and Scripting | 7 | 12-30-2008 10:02 AM |
| comment/delete a particular pattern starting from second line of the matching pattern | imas | Shell Programming and Scripting | 4 | 10-13-2008 03:37 AM |
| Pattern matching | blue_bird | UNIX and Linux Applications | 3 | 10-08-2008 02:23 AM |
| pattern matching in an if-then | lumix | Shell Programming and Scripting | 4 | 12-14-2007 04:25 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
sed pattern matching
Unfortunately this chap has been banned for some reason and I was looking forward to the resolution of his question: - append the position 28:33 He was asking if you can use sed to match a pattern you want to replace within a restricted range of characters in a string. Can anyone tell me how to do this? He wanted to change: - Code:
21111111110001343 000001004OLF-AA029100020091112 to: - Code:
21111111110001343 000001004OLF-1E029100020091112 But I don't want a generic match that matches the whole line, just that range highlighted in blue. Is it possible to do this using sed? |
|
||||
|
Thanks for the replies but I don't think that they quite do what I am asking for. I want to combine the replacement of the characters within the range while matching the pattern.
So the replacement only occurs if the pattern is present within that specific range of characters. |
|
||||
|
Quote:
pseudocode: Code:
print substr(line,1,27) "OLF-1E" substr(line,34) no need to think of any regex. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|