10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to sum up the values in field nr 5 in a data file that contains some file listing. The 5th field denotes the size of each file and following are some sample values.
1,775,947,633
4,738
7,300
16,610
15,279
0
0
I tried the following code in a shell script.
awk '{sum+=$5} END{print... (4 Replies)
Discussion started by: krishmaths
4 Replies
2. Shell Programming and Scripting
Hi Experts,
Please support
I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6.
... (3 Replies)
Discussion started by: as7951
3 Replies
3. UNIX for Dummies Questions & Answers
I have tried the following commands and can't get a number to format with commas:
echo 1234567.12 |awk '{printf("%-12s %20s\n", $0, comma($0)) }'
This prints out value 50000 without a comma
for i in *13*; do (cd $i && du -sk . && echo $i);done|grep -v 0000|gawk -F OFS="," ' {SUM += $1}... (8 Replies)
Discussion started by: newbie2010
8 Replies
4. UNIX for Dummies Questions & Answers
Using awk or sed, I'd like to remove leading spaces after a comma and before a right justified number in field 6. Sounds simple but I can't find a solution. Each field's formatting must stay intact.
Input:
40,123456-02,160,05/24/2012,02/13/1977, 10699.15,0
Output:... (5 Replies)
Discussion started by: Scottie1954
5 Replies
5. Shell Programming and Scripting
Hi,
Below is a scattered representation of numbers .
1 2
11 22
11 22
1 2
1 2
11 22
1 2
11 22
I need to display only the following sequence "" and delete of the remainder from the output. The output should look like (2 Replies)
Discussion started by: Ananth12
2 Replies
6. Shell Programming and Scripting
Hi all,
I have a file consisting of lines in such a format: separated by space and M1 EOS for fullstop (.) ]
e.g
M1 I
M1 have
M1 a
M1 file
M1 consisting
M1 of
M1 lines
M1 in
M1 such
M1 a
M1 format
M1 EOS
M2 This
M2 is
M3 an (4 Replies)
Discussion started by: my_Perl
4 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have a requirement wherein, I need to validate a user input of the numbers that are comma separated.
E.g . The input should be in the format 1,2,3...n (count of numbers is not known) . The user has to mention the input in this format, else it should exit from the program.
... (5 Replies)
Discussion started by: 12345
5 Replies
8. Shell Programming and Scripting
I have a csv file with lines like the followings
123456,"ABC CO., LTD","XXX"
789012,"DEF LIMITED", "XXX"
before I bcp this file to database, the comma in "CO.," need to be removed first.
My script is cat <filename> | sed 's/"CO.,"/"CO."/g'
but it doesn't work. Can anyone here able to... (2 Replies)
Discussion started by: joanneho
2 Replies
9. UNIX for Dummies Questions & Answers
I have 10,000 lines to remove the commas after the 3rd column. Any help will be appreciated!
Removing commas after the 3rd column
Input
aaaaa,bbbbb,cccccc,ddddddd
aaaaa,bbbbb,cccccc
aaaaa,bbbbb,cccccc,ddddddd,eeeeee
aaaaa,bbbbb,cccccc,ddddddd,eeeeee,fffffff........(limit of comma is not... (13 Replies)
Discussion started by: buddyme
13 Replies
10. Shell Programming and Scripting
I have one me.txt file like
aaa 765 gfre 534 jhk 321
cvvb 98 hftg 2 bdg2 hfuk 65
etc..
now I want to remove all numbers form that file using shell script and out put will be printed in me1.txt
output:
aaa gfre jhk
cvvb hftg bdg hfuk
please help me. (2 Replies)
Discussion started by: rinku
2 Replies