10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Question: Write a command to print the fields in a text file in reverse order?
awk 'BEGIN {ORS=""} { for(i=NF;i>0;i--) print $i," "; print "\n"}' filename
I was thinking it should be (what is the need to set ORS="" ? )-
awk 'BEGIN { for(i=NF;i>0;i--) print $i," "; print "\n"}' filename (3 Replies)
Discussion started by: Tanu
3 Replies
2. Shell Programming and Scripting
Hello Team,
here is the code:
scripts]# ls /etc/init.d/ | awk 'BEGIN{ORS=" && "} /was.init/ && !/interdependentwas/ && !/NodeAgent/ && !/dmgr/{print "\$\{service_cmd\} "$0 " status"}' 2>/dev/null
${service_cmd} cmserver_was.init status && ${service_cmd} fmserver_was.init status &&... (6 Replies)
Discussion started by: chandana.hs
6 Replies
3. Shell Programming and Scripting
Hello,
I am trying to filter fastq file (in short, every 4 lines to be a record) based on the GC counts (GC-contents) in sequence (i.e. field 2), which is the count % of the G/C chars in the string. The example script is to pick up records with GC contents > 0.6 in the sequence (second field). ... (9 Replies)
Discussion started by: yifangt
9 Replies
4. SCO
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
5. Shell Programming and Scripting
While running gawk, OS stating that command not found. (5 Replies)
Discussion started by: sbaisakh
5 Replies
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
Hi all
I’m looking for a perl equivalent to this command string
I need to imbed this in a existing perl script
cat file1 | gawk -F"|" '{print $1","$2,",",$3,",",$11 >> "new-file"}'
Thank you (4 Replies)
Discussion started by: Ex-Capsa
4 Replies
8. Shell Programming and Scripting
Hi.
I'm having trouble using gawk within a bash script and I can't figure out why.
I have a command that takes in a data file with two columns, the first one numbers and the second words. My code takes each line, and prints the word its corresponding number of times. The code works from the... (2 Replies)
Discussion started by: cdislater
2 Replies
9. Shell Programming and Scripting
The following message is being prompted while using gawk in my ksh :
gawk: not found
any idea how to fix this ? (1 Reply)
Discussion started by: sinpeak
1 Replies
10. Shell Programming and Scripting
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