Search Results

Search: Posts Made By: nith_anandan
1,895
Posted By Scott
I presumed the $ is to prepend to the output of...
I presumed the $ is to prepend to the output of hostname and cut to act as a variable.


eval ping -c 3 \$$(hostname|cut -c-2)


Someone will be along in a minute to explain that "eval is...
1,570
Posted By Chubler_XL
Looks like you have some tabs in there, try: ...
Looks like you have some tabs in there, try:

awk '
!/Slno/ { name=$1; next}
{
$1=$1" name";
for(i=2;i<=NF;i++) $i=$i" "name
}
1
' FS='\n' ORS='\n\n' OFS='\n' RS= infile
1,570
Posted By Chubler_XL
Slight change to RudiC's solution to get last...
Slight change to RudiC's solution to get last "name" field printing:

awk '/name/ {getline name; next} NF {print $0, $1=="Slno"?"name":name}' file
Slno vlan name
1 600 600
2 609 600
3 700 600...
1,570
Posted By RudiC
Please use code tags as required by forum rules! ...
Please use code tags as required by forum rules!

Tryawk '/name/ {getline name; next} NF {print $0, $1="Slno"?"name":name}' file
Slno vlan name
1 600 name
2 609 name
3 700 name
Slno vlan name...
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 09:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy