Mephi wrote:
I need to add a value to the 25th item in each line. Other than knowing that value is numeric and 10 characters long, I don't know anything more about it.
running the command: sed -n -e '/text/p' "log _20090814_162009" | awk '{print $25}' gives: 1363231555 ...
I need to able to make them look like: 1000000001363231555 ...
Just prepend it to the field before printing them:
awk '{$25="100000000"$25; print}'
for example:
mak@yoda:~$ echo "a 1363231555 c d" | awk '{$2="100000000"$2; print}' a 1000000001363231555 c d
-- Martijn
Wow.
Thankyou :-)
Matt
-----Original Message----- From: Martijn Koster [mailto:mak-alug@greenhills.co.uk] Sent: 14 August 2009 19:29 To: Mephi Cc: main@lists.alug.org.uk Subject: Re: [ALUG] Really awkward text parsing shell script question
Mephi wrote:
I need to add a value to the 25th item in each line. Other than knowing
that value is
numeric and 10 characters long, I don't know anything more about it.
running the command: sed -n -e '/text/p' "log _20090814_162009" | awk '{print $25}' gives: 1363231555 ...
I need to able to make them look like: 1000000001363231555 ...
Just prepend it to the field before printing them:
awk '{$25="100000000"$25; print}'
for example:
mak@yoda:~$ echo "a 1363231555 c d" | awk '{$2="100000000"$2; print}' a 1000000001363231555 c d
-- Martijn