[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Sed/awk question (plus ca. 2006 Chuck Norris jokes)
From: |
Bill Dorrian |
Subject: |
[Help-bash] Sed/awk question (plus ca. 2006 Chuck Norris jokes) |
Date: |
Tue, 15 Jul 2014 18:24:38 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
I'm working on an awk/grep/sed problem. Is there one line of BASH code
would I use to make the two "chucknorris" $output variables into the
statements below them? Note that the comma-delimited list can be between
one and ten items long, so it would have to compensate for that somehow.
Also, note the addition of "@chucknorris" and "man" to the beginning and
end of each line.
*From the first machine:*
$output=`ssh server1 cat /etc/chuck.txt`
*Actual output: *
swims through land
*Desired output:*
@chucknorris (swims,,) (through,,) (land,,) (man,,)
*From the second machine:*
$output=`ssh server2 cat /etc/chuck.txt`
*Actual output: *
counted to infinity twice
*Desired output:*
@chucknorris (counted,,) (to,,) (infinity,,) (twice,,) (man,,)
For the awk portion, an *echo "@chucknorris" `cat output| awk '{print
"("$1",,)"" ("$2",,)"}'`* option probably won't work, since the number
of fields is variable.
- [Help-bash] Sed/awk question (plus ca. 2006 Chuck Norris jokes),
Bill Dorrian <=