part of my code is as below :
output=$(cat databaselog | awk '{print $9,$1,$2,$6}' )
echo $output >> savedfile
Output will be something like this , saved in a new file called savedfile
name1 date1 id1 ip1 name2 date2 id2 ip2 name3 date3 id3 ip3
But i want it to be like this:
name1 date1 id1 ip1
name2 date2 id2 ip2
name3 date3 id3 ip3
i know its quite easy , but i cant find the right way to do it , pls help thanks!
echo "$output" >> savedfile
... – AdminBee May 28 '21 at 07:08$output
in your call toecho
, why are you even using that variable when you could just doawk '{print $9,$1,$2,$6}' databaselog >>savedfile
? – Kusalananda May 28 '21 at 07:10