1

I'm relatively new to linux and I was trying to subset certain rows out of a file alphabetically. Basically I have a column with 3 or 4 letter symbols (it's trade data, they're ticker symbols) and I want to only save ones between certain times, and certain ticker symbols. (I want only trades between 2:10 and 3:05 and only trades that occurred in symbols SA through TZ) I tried this gawk script and get the times right

|gawk '{if $2>1410000 && $2<1505000) print $0}'

This got all the times out that I wanted to. Is there a similar gawk script (or sed maybe?) that I can do to get rid of all the tickers up to SA, and those after TZ?

Thanks.

4

1 回答 1

1

gawk '($2 > 1410000 && $2<1505000) && (substr($1,1,2) >= "SA" && substr($1,1,2) <= "TZ"))'

请注意,在 awk 中,一个空的操作语句“{...}”会打印记录。

[编辑-清理]

于 2013-01-22T16:28:56.783 回答