| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
Command garbled
|
Original Message
|
Name: nimi
Date: September 12, 2006 at 22:21:26 Pacific
Subject: Command garbledOS: UnixCPU/Ram: NAManufacturer/Model: NA |
Comment: YMD=`date +%d/%M/%Y` I have an existing script with the following output (in.txt) 1|INTNAT|0|12963|12963|0|CANGT I would like to run a script to insert the date (YMD) at the end of each row in a text file. My output should be 1|INTNAT|0|12963|12963|0|CANGT|13/09/2006 I used the below command and it is giving me command garbled. What is wrong with the command? $FIL = in.txt sed 's/$/|'"${YMD}"'\/' $FIL > test1.txt mv test1.txt >> $FIL Nimi
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: nimi
Date: September 13, 2006 at 02:41:18 Pacific
|
Reply: (edit)I found the solution. DAY=`date +%d` MONTH=`date +%m` YEAR=`date +%Y` sed 's/$/ '$DAY'\/'$MONTH'\/'$YEAR'/g' test1.txt Nimi
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Unix Forum Home