gawk will work or not ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting gawk will work or not ?
# 1  
Old 03-13-2007
gawk will work or not ?

Hai

I am using

bash-2.03$ bash --version
GNU bash, version 2.03.0(1)-release (sparc-sun-solaris)

I am not able to use gawk command its showing command not found , why ?

Eg:
awk 'NR==1' fix.txt | gawk 'BEGIN { FIELDWIDTHS = "3 2" } { printf($1"|"$2); }'
---------------------------------------
bash: gawk: command not found
Broken Pipe

I want to find num of columns with whitespace as field seperator, is it possible with awk

Thank u
# 2  
Old 03-13-2007
either because it is not installed, or because it is not in the PATH.

try /usr/sfw/bin/gawk
# 3  
Old 03-13-2007
possibly you could check it in third-party binaries

Code:
/opt/third-party/bin/gawk

# 4  
Old 03-13-2007
Quote:
Originally Posted by tkbharani
Hai

I am using

bash-2.03$ bash --version
GNU bash, version 2.03.0(1)-release (sparc-sun-solaris)

I am not able to use gawk command its showing command not found , why ?

Eg:
awk 'NR==1' fix.txt | gawk 'BEGIN { FIELDWIDTHS = "3 2" } { printf($1"|"$2); }'
---------------------------------------
bash: gawk: command not found
Broken Pipe
Because gawk is either not installed or not in your PATH.

Why would you use both awk and gawk?

gawk 'BEGIN { FIELDWIDTHS = "3 2" }
NR==1 { printf($1"|"$2); exit}' fix.txt

Quote:
I want to find num of columns with whitespace as field seperator, is it possible with awk
If you only need the first line, you don't need awk or gawk:

Code:
read -r line < FILENAME
set -f
set -- $line
echo $#

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Gawk command

Hello experts :) I have a question about Gawk command on AIX, could someone tell me the function of this command ? i have a script which has a gawk command : /usr/bin/xmllint --format /data/work/PROU/aggregates.flat.xml | gawk '! /<!--.*-->/ {print $0}' | gawk -f... (3 Replies)
Discussion started by: rimob
3 Replies

2. SCO

Gawk Question

I am trying to use gawk to search a file and put the second value of the string into a string. gawk -F: '$1~/CXFR/ {print $2}' go.dat go.dat ==================== HOME :/ CTMP :/tmp CUTL :/u/rdiiulio/bin CWRK :/u/work CXFR :/u/xfer ... (4 Replies)
Discussion started by: trolley
4 Replies

3. SCO

Need help with gawk

I am trying to use gawk to search a file and put the second value of the string into a string. gawk -F: '$1~/CXFR/ {print $2}' go.dat Below is the file 'go.dat' ==================== HOME :/ CTMP :/tmp CUTL :/u/rdiiulio/bin CWRK :/u/work CXFR :/u/xfer ... (1 Reply)
Discussion started by: trolley
1 Replies

4. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies

5. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

6. Shell Programming and Scripting

gawk: not found

While running gawk, OS stating that command not found. (5 Replies)
Discussion started by: sbaisakh
5 Replies

7. Programming

need help with gawk script

hi i've already created this script. When I execute the script it takes the argument and compares it to the 3rd column of the script. What I was wondering if I could get some help with is. I want to add another column to the script and it will be the result of a set number for example, (2000 - 3rd... (3 Replies)
Discussion started by: gengar
3 Replies

8. Shell Programming and Scripting

Gawk Help

Hi, I am using the script to print the portion of the file containing a particular string. But it is giving error "For Reading (No such file or directory). I am using cygwin as unix simulator. cat TT35*.log | gawk -v search="12345678" ' /mSOriginating /,/disconnectingParty/ { ... (1 Reply)
Discussion started by: vanand420
1 Replies

9. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

10. Shell Programming and Scripting

gawk HELP

I have to compare records in two files. It can be done using gawk/awk but i am unable to do it. Please help me File1 ABAAAAAB BC asa sa ABAAABAA BC bsa sm ABBBBAAA BC bxz sa ABAAABAB BC csa sa ABAAAAAA BC dsa sm ABBBBAAB BC dxz sa File 2 ABAAAAAB BC aas ba ABAAAAAB BC asa sa... (6 Replies)
Discussion started by: sandeep_hi
6 Replies
Login or Register to Ask a Question