10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Here is the awk code i wrote :
if ; then
gawk -v field_position="$field_position" -v field_length="$field_length" -v header="$header" -v trailer="$trailer" -v lr="$lr" '{
if(NR==1&&header=="1")
{
next
}
if(NR==lr&&trailer=="1")
{
next
}... (1 Reply)
Discussion started by: ysvsr1
1 Replies
2. 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
3. Shell Programming and Scripting
VARA='hello|welcome|gone|fantastic|superb|nicecar'
if VARA contains a pipe "|", i want the contents of VARA to be tranformed to:
VARA="(hello) (welcome) (gone) (fantastic) (superb) (nicecar)"
so that, when i echo the contents of $VARA like this:
echo "$VARA"
or like this:
print... (8 Replies)
Discussion started by: SkySmart
8 Replies
4. Emergency UNIX and Linux Support
Hi,
my file has the data like below:
11,231,ABCVAV
22,AAHJHAj22,hdsjkhdls
22,dhskjhdkshd
22,gdgkdkadh
11,232,dgsjgdjh
22,ghdskahdkja
22,shdkajshs
11,233,ddjs
22,dhjkahkd
22,hsajhaah
11,231,sjkjsjj
22,ahkh
22,hsakh
From the above i need only the records which starts as 11,231... (5 Replies)
Discussion started by: pandeesh
5 Replies
5. 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
6. 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
7. Shell Programming and Scripting
hi,
i am having three files which is having following data
file1:
field1 field2 field3
1 A B
2 C D
3 E F
file2:
4 G H
1 I J
5 K L
file3:
4 M N (3 Replies)
Discussion started by: angel12345
3 Replies
8. 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
9. 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
10. 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