hello,
I'm trying to display Unix variable using printf command.
Code:
Code:
awk '{ if ( $0 ~ /string/ ) {
printf( "%s\n%s\n",$0,"dsd"); #this one works
printf( "%s\n%s\n",$0,$HOME); #this does not work
} else {
print $0;
}
}' param1_1.txt
I could use here echo command but I'm not sure how to use it properly.
I mean "properly" because the in
this may be basic thing for everyone here, but i cant push awk to print the variable user input which is INS, please help.
code:
Code:
INS=$1
printf '\n'
symdg list | grep $INS-clone | awk -v i=$INS '{ID=substr($4,9,4)}{print "Device Group: "$1,"at Array "ID,i}'
output:
Code:
$ ./test.sh patty
awk: syntax error near line 1
awk: bailing out near line 1
I have a file1.txt
file1.txt
Code:
F-120009210","Felix","U-M-F-F-F-","white","yes","no","U-M-F-F-F-","Bristol","RI","true"
F-120009213","Fluffy","U-F-","white","yes","no","M-F-","Warwick","RI","true"
U-12
Hi Guys,
I am getting count from a file (pipe delimited).
Code:
"23"|"9896"|"20090101"|"New Load"
I am using the following code to get the first two counts.
Code:
CtrlFileByte=`/bin/gawk -F"|" '{ print $1 }' $ControlFile`;
CtrlFileCnt=`/bin/gawk -F"|" '{ print $2 }' $ControlFile`;
But the problem is file Byte is not mand
Perl Legends,
I am trying to debug below perl script. Till "h1" and "h2" the value in variable is initialized.
Hi,
i can print 2nd, 4th and 6th columns in a file using the shell command:
awk -F "|" '{print $2 $4 $6}' file1.txt
Now, the position and number of columns can be variable and from a variable POSLIST
So let's say
POSLIST='$2 $4 $6'
when i use the command:
a)
awk -F "|" '{print $POSLIST}' file1.txt
it throws the error:
awk: Field $() is not correct.
b)
awk -v VAR=$POSLIST
Hi,
Below is starting entry of my script
#!/bin/ksh
Usage()
{
print "Usage: $0 ID OPTION SERVER"
print "<br>Where :"
print "<br>Enter your ID into PARAM1, OPTION in the PARAM2 and SERVER in the PARAM3 field"
print "<br>ID should be a valid ID"
print "<br>OPTION should be either BOUNCE or STATUS"
print &q
Hey everyone, I have a simple simple problem that is literally driving me insane.
Basically, I have a database of numbers seperated my spaces. I just took a segment of my code because I am soooo completely lost with the output!!
If the database is:
1 2 3 9 7 6 4 5 6 7
Hi !
I am a newbie with Unix and I try to remove the "|" FS in this file:
Code:
1|2|3|4|5|6
to get:
Code:
123456
by using:
Code:
gawk 'BEGIN{FS=""} {gsub("|","",$0); print $0}' file
but nothing changes.
Or even when I try to change "|" by "%"with this command:
Code:
gawk 'BEGIN{FS=""} {gsub("