New answers tagged

1 vote

Summing real numbers from a text file

awk '{ sum += $1 } END { print sum }' avrg.bc.txt
user avatar
1 vote

keep each line containing x only if column y is the first containing x. remove the rest containing x

So, I went this route, which is nice and simple and seems to be working for me: awk -F, '!x[$4]++' A far as I can tell, awk here is checking the 4th column (field), if it's not seen it before, then ...
user avatar
0 votes

sed: how to replace line if found or append to end of file if not found?

As a programmer not accustomed to shell scripts it was easier to construct a more readable (for me) command by first deleting any existing match and then appending the value to the end of file my-...
user avatar
  • 101

Top 50 recent answers are included