Computing.Net > Forums > Unix > Command garbled

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Command garbled

Reply to Message Icon

Name: nimi
Date: September 12, 2006 at 22:21:26 Pacific
OS: Unix
CPU/Ram: NA
Product: 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



Sponsored Link
Ads by Google

Response Number 1
Name: nimi
Date: September 13, 2006 at 02:41:18 Pacific
Reply:

I found the solution.

DAY=`date +%d`
MONTH=`date +%m`
YEAR=`date +%Y`

sed 's/$/ '$DAY'\/'$MONTH'\/'$YEAR'/g' test1.txt


Nimi


0
Reply to Message Icon

Related Posts

See More







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


Sponsored links

Ads by Google


Results for: Command garbled

Receiving sed: command garbled www.computing.net/answers/unix/receiving-sed-command-garbled/6167.html

print command anamoly www.computing.net/answers/unix/print-command-anamoly/5722.html

abt sed www.computing.net/answers/unix/abt-sed/6120.html