![]() |
Hello and Welcome from 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 |
| Storing commands in $variables. | Paulw0t | Shell Programming and Scripting | 7 | 08-08-2008 06:42 PM |
| Using variables in sed commands | hcclnoodles | Shell Programming and Scripting | 2 | 01-02-2007 08:56 AM |
| Referencing variables in commands | mharley | Shell Programming and Scripting | 3 | 03-31-2005 02:37 AM |
| Subtracting Variables which are commands | Astudent | UNIX for Dummies Questions & Answers | 2 | 03-30-2001 10:55 AM |
| Subing Variables with commands. | Astudent | UNIX for Dummies Questions & Answers | 1 | 02-26-2001 05:02 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Using variables within awk/sed commands
Can I use my own variables within awk and sed for example:
I've written a while loop with a counter $i and I want to use the value of $i within sed and awk to edit certain lines of text within a data file. I want to use : sed '1s/$/texthere/g' data.csv Like this: sed '$is/$/$age/g' data.csv but it only displays the name of the variable not the value it contains. $age is the result of a calculation created within the while loop that I would like to append to the end of each line. Any help is greatly appreciated ![]() |
|
||||
|
Hi ,
i used with success the sed command : ( in the date value the slash is protected by \ ) cat crontab-test|sed -e "s/Modifie le : 20\/06\/08/Modifie le : 11\/22\/33/g" but when i want to put the values in variables j_modif_old="20/06/08" j_modif_new="11/22/33" cat crontab-test|sed -e "s/Modifie le : ${j_modif_old}/Modifie le : ${j_modif_new}/g" i have the following error : sed: Function s/Modifie le : 20/06/08/Modifie le : 11/22/33/g cannot be parsed. how can i do this , protecting the "/" when parsing ? thanks in advance Christian |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|