10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a simple awk script:
BEGIN{}
{
$a=$2-$1;
print $a
}
END{if(NR==0){
print "0"
}
}
to which I provide the following input
2.9 14
22.2 27 (4 Replies)
Discussion started by: jamie_123
4 Replies
2. Shell Programming and Scripting
I have having a heck of a time figuring this out so any help is much appreciated.
Here is the code where it seems to be dying, I bolded the part it is complaining about:
$sth = $dbh->prepare( $query ) or die "error with query\n";
$sth->execute() or die "error executing query ...\n";
while(... (1 Reply)
Discussion started by: savigabi
1 Replies
3. Ubuntu
I'm fairly new to unix and I was trying to change the name of my host and my user. I changed the name in /hostname using this: gksudo gedit /etc/hostname I then tried changing the name back but it still gave the same error: {env_reset,... (1 Reply)
Discussion started by: H3jck
1 Replies
4. Shell Programming and Scripting
awk 'BEGIN{print 1.2.3.4}'
1.20.30.4
Can anyone explain why has extra "0" in the IP address? (3 Replies)
Discussion started by: newoz
3 Replies
5. Shell Programming and Scripting
Hi Experts
I am facing a weird issue while using print statement in awk. I have a text file with 3 fields shown below:
# cat f1
234,abc,1000
235,efg,2000
236,jih,3000
#
When I print the third column alone, I dont face any issue as shown below:
# awk '{print $3 }' FS=, f1
1000
2000... (5 Replies)
Discussion started by: guruprasadpr
5 Replies
6. Shell Programming and Scripting
hi all,
i am writing a wrapping script to burn subtitle into video file using transcode. I got this very weird error:
code:
inFile="movie.avi"
subFile="sub.srt"
outFile="movie_sub.avi"
strExc="-i $inFile -x 'mplayer=-sub $subFile' -w $vidBR -o $outFile -y xvid"
echo "transcode $strExc"... (2 Replies)
Discussion started by: tduccuong
2 Replies
7. Shell Programming and Scripting
Hi,
I am not sure what I am doing wrong but I am messing up some logic here. The input file is something like this:
*___String Type A Here___String Type B Here___123
*___ ___String Type B Here___123
*___ ___String Type B Here___123
*___ ... (6 Replies)
Discussion started by: Legend986
6 Replies
8. Shell Programming and Scripting
my desired output is like this:
so the thing is, I only need to show every of this part out
but the frequency of that data is not fixed, so sometimes it may have 4 lines, or 6 lines or whatever in that file. However, the last line will always have empty space/line below it. (13 Replies)
Discussion started by: finalight
13 Replies
9. UNIX for Advanced & Expert Users
Hi All,
a bit of a weird one here. I'm trying to pass a variable into an awk command, and I keep getting an error.
I have the line
nawk -F"," -v red=$random_variable '{print $red}' $w_dir/$file_name > $w_dir/${column_name}
that keeps failing with the error
nawk: can't open file {print... (17 Replies)
Discussion started by: Khoomfire
17 Replies
10. UNIX for Advanced & Expert Users
Guys, this one is rather odd. I've got an array of numbers, and I'm trying to select only the records with the string "Random" in the 4th column. I'm using awk in this format:
awk '{ if (( $6 -eq Random )) print $0 }'
For some odd reason, this is simply giving me the list of all the entries... (4 Replies)
Discussion started by: Khoomfire
4 Replies