Junes
1
A simple question, but i am finding it diffcult to find the answer.
Can you please tell me how i can get the output of two line on one.
I am aware i need to enter \ something, but no sure which charcter, can you advice.
CODE
for i in `cat LDN_HOSTS_190813 | grep -i LDN | awk '{print $1}' | sort -u `
do
echo "$i" ; bpimagelist -client $i -d 08/14/2013 18:00:00 -U | egrep -vi "Expires|-" | awk ' { if($5 > 1000000) print $0} ' | awk 'NR==1{print $1,$2,$5,$10,$11}'
Output currerntly
algomd01
08/16/2013 20:23 1577925 LDN_WAT_UX_DEV
allocd01
allocp01
08/18/2013 23:50 2575795 LDN_CAM_UX_PRD
apmapp01
Output required
algomd01 08/16/2013 20:23 1577925 LDN_WAT_UX_DEV
allocd01
allocp01 08/18/2013 23:50 2575795 LDN_CAM_UX_PRD
apmapp01
For awk i think you can use
printf ("%s", $0)
instead of
print $0
Hope it helps.
for i in `cat LDN_HOSTS_190813 | grep -i LDN | awk '{print $1}' | sort -u ` do echo "$i `bpimagelist -client $i -d 08/14/2013 18:00:00 -U | egrep -vi "Expires|-" | awk ' { if($5 > 1000000) print $0} ' | awk 'NR==1{print $1,$2,$5,$10,$11}'`"
Junes
4
Sorry did not work... Same output as before capitanui and prasperl
Please try the below given code in your shell..just to want to see the outcome
echo "I am `whoami`!"
Junes
6
# echo "I am `whoami`!"
I am root!
---------- Post updated at 01:00 PM ---------- Previous update was at 12:57 PM ----------
adsdbi01.zit.commerzbank.com\c
algomd01.zit.commerzbank.com\c
08/16/2013 20:23 1577925 LDN_WAT_UX_DEV
Thats good..My suggestion was also on the same logic...I guess your "$i" itself has a \n
...My suggestions
for i in `cat LDN_HOSTS_190813 | grep -i LDN | awk '{print $1}' | sort -u `
do
echo -n "$i"
echo "`bpimagelist -client $i -d 08/14/2013 18:00:00 -U | egrep -vi "Expires|-" | awk ' { if($5 > 1000000) print $0} '`"
Or
for i in `cat LDN_HOSTS_190813 | grep -i LDN | awk '{print $1}' | sort -u `
do
var1=`echo "$i" | tr -d '\n'`
var2=`bpimagelist -client $i -d 08/14/2013 18:00:00 -U | egrep -vi "Expires|-" | awk ' { if($5 > 1000000) print $0} '`"
echo "$var1 $var2"
Junes
8
Thanks that has worked.....