struggling within awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting struggling within awk
# 1  
Old 10-08-2007
struggling within awk

!#/bin/bash

cat input.sh | awk '
{
cur1=tolower($1)

cur2=tolower($2)


rsh $cur1 report | grep $cur2

# i just want to make the code line to work
} '

the error which i get is ....


./madh1.sh: line 1: !#/bin/bash: No such file or directory
awk: cmd. line:13: rsh $cur1 report | grep tree | grep $cur2
awk: cmd. line:13: ^ syntax error
awk: cmd. line:13: rsh $cur1 report | grep tree | grep $cur2
awk: cmd. line:13: ^ syntax error


i'm new to shell scripting & not comfortable with the awk..can you please help me..

thanks in advance,

regards,
geeko.
# 2  
Old 10-08-2007
Quote:
Originally Posted by geeko
!#/bin/bash

cat input.sh | awk '
{
cur1=tolower($1)

cur2=tolower($2)


rsh $cur1 report | grep $cur2

# i just want to make the code line to work
} '

the error which i get is ....


./madh1.sh: line 1: !#/bin/bash: No such file or directory
awk: cmd. line:13: rsh $cur1 report | grep tree | grep $cur2
awk: cmd. line:13: ^ syntax error
awk: cmd. line:13: rsh $cur1 report | grep tree | grep $cur2
awk: cmd. line:13: ^ syntax error


i'm new to shell scripting & not comfortable with the awk..can you please help me..

thanks in advance,

regards,
geeko.
1) you got your shebang wrong.
2) to call external commands like rsh, grep etc, you can use system()
3) no need for cat.
# 3  
Old 10-09-2007
hi all,

have been trying to call rsh in the the awk script from 2 days, i didn't get
it finally.. how to use rsh and grep within awk script?

-thanks,
geeko
# 4  
Old 10-09-2007
show your code
# 5  
Old 10-09-2007
[QUOTE=ghostdog74;302139726]show your code[/QUOTE

the code is above this post Smilie, anyways my code is like this

cat input.txt | awk ' {

rsh $1 quota report | grep tree| grep $2
# in the above line i'm not able to do rsh, grep...
}


the error is

./madh1.sh
awk: cmd. line:5: sh $1 quota report | grep tree | grep $2
awk: cmd. line:5: ^ syntax error
awk: cmd. line:5: sh $1 quota report | grep tree | grep $2
awk: cmd. line:5: ^ syntax error
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies

2. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

3. Shell Programming and Scripting

Parsing file: struggling against sed command

Hello fellows, Sure you can help this poor guy that is struggling against sed command, being unable to tame it I have a lot of files like this: From this one, I need to obtain values highlighted in bold/red To do so, I am executing this piece of code inside a loop: ... (10 Replies)
Discussion started by: manolain
10 Replies

4. UNIX for Dummies Questions & Answers

Struggling to combine two Greps statements

Greetings! I have been tasked to create a report off files we receive from our hardware suppliers. I need to grep these files for two fields 'Test_Version' and 'Model-Manufacturer' ; for each field, I need to capture their corresponding values. When running each statement separately, I get... (4 Replies)
Discussion started by: alan
4 Replies

5. Shell Programming and Scripting

Struggling with AWK

I know this is an easy problem, but I've been struggling with it all morning and finally admit I need help. I have two files that I need to compare. After doing this the easy way (grep -F) I realize that there are other fields in file2 that match field1 in file1, so I turned to awk. I want to... (7 Replies)
Discussion started by: moldoverb
7 Replies

6. Shell Programming and Scripting

Struggling with arrays and delimited file

Hi, I am trying to use arrays in my script but can not seem to get it to work. I have a file called sections, this contains headers from a tripwire log file, separated by "@" but could be "," if easier The headers will be used to cut sections from the log file into another to be mailed. ... (5 Replies)
Discussion started by: pobman
5 Replies

7. UNIX for Advanced & Expert Users

Help- Unix File Compare- Struggling

I had posted this earlier about 3 weeks ago and had recieved a response and I did sort both the files and the comm command is still not working. Can someone please assist me, I would really appreciate it. Below is what I am trying to do I need to compare File A with File B and create FILE C... (2 Replies)
Discussion started by: guiguy
2 Replies

8. Shell Programming and Scripting

Struggling with a text file

Hi, I am struggling with the following... I try to grep out information of a text file I got with lynx, a text browser. The text file I get from lynx with dump is attached in the bottom. What I would like to get is another file containing the astro-ph/98324 (number) and title and list of... (13 Replies)
Discussion started by: pau
13 Replies

9. UNIX for Dummies Questions & Answers

Struggling with mkfifo

Gurus, I did my research (on google, this site and my local library) but I am *still* lost. I am trying to teach myself about `named pipes` playing around with MKFIFO (Why not?). (1) It seems MKNOD is reserved to ROOT whereas MKFIFO is accessible to all users. Am I correct? If the answer is... (20 Replies)
Discussion started by: alan
20 Replies

10. UNIX for Dummies Questions & Answers

struggling with addusr ...

I'm completely new to UNIX, and having got the hang of directory navigation / creation (Just about), I think it is time to create an FTP account, so that I can upload a web site remotely. Herein lies the problem... 1: I cannot find a breakdown of addusr commands, so I cannot create a... (2 Replies)
Discussion started by: Dufty
2 Replies
Login or Register to Ask a Question