How to format console output in columns

You can use the column command: me@home$ column -t output.txt CHAR.L 96.88 -6.75 (-6.49%) MXP.L 12.62 -1.00 (-7.41%) NEW.L 7.88 -0.75 (-8.57%) AGQ.L 17.75 -0.62 (-3.40%) RMP.L 13.12 -0.38 (-2.75%) RRR.L 3.35 -0.20 (-5.71%) RRL.L 7.95 -0.15 (-1.85%) SOU.L 1.73 -0.10 (-5.22%) YELL.L 5.47 -0.04 (-0.73%) AMC.L 9.75 -0.01 (-0.05%) PLU:USOP 95.40 0.00 (+0%) BP-.L … Read more

grep a large list against a large file

Try grep -f the_ids.txt huge.csv Additionally, since your patterns seem to be fixed strings, supplying the -F option might speed up grep. -F, –fixed-strings Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. (-F is specified by POSIX.)

How to Sum a column in AWK? [duplicate]

The split seems unnecessary here, especially considering you’re using awk, which is made for field based processing. If your file is truly comma-separated, the following code seems much simpler, IMO: awk -F’,’ ‘{sum+=$57;} END{print sum;}’ file.txt For example, given the following input: ~$ cat testawk.txt a,a,aa,1 a,a,aa,2 d,d,dd,7 d,d,dd,9 d,dd,d,0 d,d,dd,23 d,d,dd,152 d,d,dd,7 d,d,dd,5 f2,f2,f2,5.5 … Read more