Unable to run awk command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unable to run awk command
# 1  
Old 08-05-2015
Code Unable to run awk command

hello Don Cragun sir, i am not able to run this command

Code:
awk 'NR==FNR{if($0~/^>/){i=substr($0,2);getline};a[i]=a[i] $0;next}{print ">" $1 ORS substr(a[$1], $2, $3-$2+1)}' file1 FS=\\t file2

i searched do text you on twitter, facebook but i get no reply from over there so i post here.

---------- Post updated at 11:59 PM ---------- Previous update was at 11:42 PM ----------

my question is where is new result file created?

Moderator's Comments:
Mod Comment This was moved here from a thread discussing a completely different topic.

Last edited by Don Cragun; 08-05-2015 at 02:37 AM.. Reason: Remove duplicated update and add CODE tags.
# 2  
Old 08-05-2015
Without showing us the output that was produced, we don't know what happened when you tried running that command. Did it produce any error messages? What is in file1? What is in file2? What output were you trying to produce from those input files?

As with any awk script, if you don't redirect the output when you write text in your awk script and you don't use redirection in the shell when you invoke your awk script, any output produced by the awk script will be written to standard output.

And, you haven't said what operating system and shell you're using. As you will frequently see me say here, if you are running an awk script on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk (preferably /usr/xpg4/bin/awk especially if you're not working in the C or POSIX Locale).
# 3  
Old 08-05-2015
i put my post here sir. Sequence extraction

Last edited by Scrutinizer; 08-05-2015 at 03:35 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Run awk command inside ssh

I am trying to run an awk command inside of ssh and it is not working. These are AIX servers. for i in `cat servers`; do ssh $i "/bin/hostname; df -g | awk '/dev/ && $4+0 > 70'"; done server1 server2 server3 server4 I also tried these two methods and they did not work. It just seemed... (5 Replies)
Discussion started by: cokedude
5 Replies

2. Shell Programming and Scripting

Run awk command on remote host

I have below command to check for error logs from last 24 hours from the file : /var/log/messages/ The command is working fine on the local host. sudo awk -F - -vDT="$(date --date="24 hours ago" "+%b %_d %H:%M:%S")" ' DT < $1' /var/log/messages | egrep -i "error|fail" I want to run the... (8 Replies)
Discussion started by: rahul2662
8 Replies

3. Shell Programming and Scripting

How to use a loop for multiple files in a folder to run awk command?

Dear folks I have two data set which there names are "final.map" and "1.geno" and look like this structures: final.map: gi|358485511|ref|NC_006088.3| 2044 gi|358485511|ref|NC_006088.3| 2048 gi|358485511|ref|NC_006088.3| 2187 gi|358485511|ref|NC_006088.3| 17654 ... (2 Replies)
Discussion started by: sajmar
2 Replies

4. Post Here to Contact Site Administrators and Moderators

Unable to pass shell script parameter value to awk command in side the same script

Variable I have in my shell script diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies

5. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

6. Shell Programming and Scripting

Unable to run command after ssh

Hello, I am trying to create a ksh script to login to server and collect gather output of some command to troubleshoot some issue. DATE=`date +%b.%d.%Y.%M.%H` echo " Enter emp id to login to server" read Eid Eid=$Eid echo " Enter hostname of the system" read HOST HOST=$HOST... (2 Replies)
Discussion started by: saurabh84g
2 Replies

7. Shell Programming and Scripting

Unable to run function

Hi, I have a separate file with a ksh function in it. When I try to run it, I get an error about permissions: user@~/scripts/functions$ ksh f_fill_testfunc ksh: f_fill_testfunc: cannot open user@~/scripts/functions$ ls -l batch_functions/f_fill_testfunc -rwxr-xr-x 1 user user 1105 Aug... (18 Replies)
Discussion started by: Subbeh
18 Replies

8. HP-UX

Unable to run some commands in HP-UX

Hi All, I want to get %cpu and %memory utilization for a given process id in HP-UX so am using the following commands 1)TOP -p <PID> am getting error message like Quitting top: pset 26323 doesn't exist,but when am using only TOP command without any options its working fine. 2)ps -e -o pcpu... (5 Replies)
Discussion started by: Ramya_Nm
5 Replies

9. Solaris

Unable to run xclock

Hello. I am trying to run xclock on newly built solaris box - These are the steps I followed: # DISPLAY=localhost:0.0 # export DISPLAY # xclock xclock: not found # cd /usr/openwin/bin # ./xclock Error: Can't open display: localhost:0.0 # Please suggest, what am i doing wrong? Thank... (27 Replies)
Discussion started by: panchpan
27 Replies

10. Shell Programming and Scripting

How to run awk command having multiple lines

Hi, Can u see the code below. set xyz = `cat testt1.txt | awk '/-----/{\ print $1 }\ ' | tail -1` I need to execute it in c shell . What is wrong with the above command. When i write everything on a single line then it is working. Can anybody help me . (0 Replies)
Discussion started by: nani_g
0 Replies
Login or Register to Ask a Question