10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello
I have a file like this
a,b,c,1,2,3,d,e,f,,,,g,h,i,,,,j,k,l
and using awk 'FS="'"{print $9,$10,$11}' does not work as I was hoping. I would like the empty fieds, i.e. between the two comma to be interpreted as a zero. is this possible?
I would like to get f 0 0 out of the above... (1 Reply)
Discussion started by: garethsays
1 Replies
2. Shell Programming and Scripting
I am trying to use awk to identify and print out records in fields that are empty along with which line they are in. I hope the awk below is close, it runs but nothing results. Thank you :).
awk
awk -F'\t' 'FNR==NR ~ /^*$/ { print "NR is empty" }' file
file
123 GOOD ID 45... (3 Replies)
Discussion started by: cmccabe
3 Replies
3. Shell Programming and Scripting
I am trying to cut a range of fields in awk. The below seems to work for removing field 50, but what is the correct syntax for removing a range ($50-$62). Thank you :).
awk
awk 'BEGIN{FS=OFS="\t"}{$50=""; gsub(/\t\t/,"\t")}1' test.vcf.hg19_multianno.txt > output.csv
Maybe:
awk... (6 Replies)
Discussion started by: cmccabe
6 Replies
4. Shell Programming and Scripting
I am trying to selectively display several columns from a db2 query, which gives me a fixed-width output (partial output listed here):
--------- -------------------------- ------------ ------
000 0000000000198012 702 29
000 0000000000198013 ... (9 Replies)
Discussion started by: ahsh79
9 Replies
5. Shell Programming and Scripting
Hi! I need to learn that how a shell script can transverse a csv file n check if any field is empty or not. means its contains two comma or space b/w commas i.e., "" or " ".
can anyone help me out how I can do that.... (10 Replies)
Discussion started by: sukhdip
10 Replies
6. Shell Programming and Scripting
Hi
file.in and file.out are in csv format. the code I have now is,
cat file.in | awk -F"," '!($1$2$3$4$5$6$7$8 in a){a;print $0}' > file.out
Here, I am printing entire line using $0. however, I want to print $1 to $150 and it should be in csv format. Cut -d is not good in performace.... (3 Replies)
Discussion started by: krishnix
3 Replies
7. Shell Programming and Scripting
Hi,
Does any one know how to avoid the scenario where awk ignores the fields having only spaces or empty fields?
for instance,
Data: "a","b","c","d",""," "
code:
awk -F, '{ print NF }' File
the output I get is 4 instead of 6 do you know how to avoid this? (6 Replies)
Discussion started by: ahmedwaseem2000
6 Replies
8. Shell Programming and Scripting
Hello all,
I have a problem with a skript of mine:
My input has the following format
1,33296 transcript_id"ENSRNOT00000018629" 0 1,33296 0
0 transcript_id"ENSRNOT00000029014" 0
0,907392 transcript_id"ENSRNOT00000016905" 0,907392
0 transcript_id"ENSRNOT00000053370" 0
0... (0 Replies)
Discussion started by: DerSeb
0 Replies
9. Shell Programming and Scripting
Hi suppose I have a csv file like this
count,1977,1978,1979
usa, , , blue
japan, red, yellow,green
india, , yellow,blue
china, blue, yellow, green
I want the output to be(replace everything, including empty data, with the most recent data):
... (1 Reply)
Discussion started by: grossgermany
1 Replies
10. Shell Programming and Scripting
hi,
I have this code:
#!/usr/bin/ksh
#SERVICES
gzcat *SERVICES* | awk '
{
SUBSCRIBERNUMBER=substr($0,1,20)
SUBSCRIBERNUMBER=trim(SUBSCRIBERNUMBER)
SERVICECODE=substr($0,22,61)
SERVICECODE=trim(SERVICECODE)
STARTDD=substr($0,63,72)
STARTDD=trim(STARTDD)
STARTDT=substr($0,74,81)... (1 Reply)
Discussion started by: naoseionome
1 Replies