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
awk 'BEGIN{
if('"$CATE"'<'"${WARN}"')
printf ("%s", "'"`Kfunc "" ; break`"'")
else if (('"${CATE}"'>='"${WARN}"') && ('"${CATE}"'<'"${CRIT}"'))
printf ("%s", "'"`Wfunc ""; break`"'")
else if ('"${CATE}"'>='"${CRIT}"')
printf... (6 Replies)
Discussion started by: SkySmart
6 Replies
4. Shell Programming and Scripting
I'm trying to do something pretty simple but its appears more complicated than expected... I've lines in a text file, separated by the comma and that I want to output to another file, without the first field.
Input file:
file1,item, 12345678
file2,item, 12345678
file2,item, ... (8 Replies)
Discussion started by: Armoric
8 Replies
5. Shell Programming and Scripting
Hi Everyone,
I am looking for neat way to grep a non-empty string that basically contains a hostname, which might be in FWDN form or without the domain, for example:
hostname.internal.domainname.net
The file I am parsing contains blan lines (^$) and also series of "-" which in other places... (2 Replies)
Discussion started by: togr
2 Replies
6. Shell Programming and Scripting
Is there some easy way to trim empty fields but only in a given range?
for example say I have csv data that looks like this:
apple,,,Granysmith,,2.50,,TimmysGrocers
Pear,Bartlett,,,,,Park,
peach,,,,Peento,3.00,Garden,TimmysGrocers
is there a way of getting the single field with data... (4 Replies)
Discussion started by: cue
4 Replies
7. Shell Programming and Scripting
Hi All,
If anybody could help me with my scenario here. I have a statement file. Example of some content:
DATE DESC Debit Credit Total Rate
02-Jan-08 Lodgement 200.00 1200.00 2.51
14-Sep-07 Withdrawal 50.00 1000.00 ... (8 Replies)
Discussion started by: yonez
8 Replies
8. 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
9. Shell Programming and Scripting
Hi,
I want to Initialize a String with 50 spaces. I can do that by
ex: Var1=" "
But i dont want to do in this way?
Is there any unix command where i can specify no of spaces to a varaible?
like space(50) (1 Reply)
Discussion started by: Shiv_18
1 Replies
10. Programming
I have a file which contains numbers as follows:
1234 9876 6789 5677 3452
9087 4562 1367 2678 7891
I need to remove the empty spaces and add commas between the numbers like:
1234,9876,6789,5677,3452,
9087,4562,1367,2678,7891
Can anyone tell me the command to do... (4 Replies)
Discussion started by: jazz
4 Replies