![]() |
|
|
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 |
| make multiple line containing a pattern into single line | VTAWKVT | Shell Programming and Scripting | 13 | 12-04-2008 06:40 PM |
| Adding a columnfrom a specifit line number to a specific line number | Ezy | Shell Programming and Scripting | 2 | 05-12-2008 09:29 AM |
| Adding new line at the end of file | somesh_p | Shell Programming and Scripting | 5 | 11-05-2007 05:47 PM |
| sed - adding new line | sovixi | UNIX for Dummies Questions & Answers | 2 | 10-09-2007 10:06 AM |
| sed - Replace Line which contains the Pattern match with a new line | kousikan | Shell Programming and Scripting | 2 | 03-24-2007 07:24 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
SED - adding a new line after pattern
Hi,
In files, I have a field Date Of Birth (DOB). After that line I need to add Date of Joining (DOJ) DOB:19-Apr-1981 needs to become DOB:19-Apr-1981 DOJ:20-Jun-2005 What can be a sed/perl line that can do it for me. Please note that DOB/DOJ I have in variables I am doing in a sh script 'line' represents file name which has names of many files which need to be enhanced. var1=`echo $line | cut -d ":" -f1` var2=`echo $line | cut -d ":" -f2` perl -e 'while (<>) { s/(DOB /$1\/DOJ: $var2/g; print }' $var1.txt > $var1\_new.txt var1 - filename var2 - DOJ data Please advise. |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|