Reputation: 4135
I have a similar infile:
1 And finally, monsieur, a wafer-thin mint.
2 Nah.
3 Oh, sir, it's only a tiny, little, thin one.
4 No. ****** off. I'm full.
5 Oh, sir. Hmm? It's only wafer thin.
6 Look. I couldn't eat another thing. I'm absolutely stuffed. Bugger off.
7 Oh, sir, just-- just one.
8 All right. Just one.
9 Just the one, monsieur. Voilà.
command:
awk '$1 >1 && $1 < 4 || $1 > 5 && $1 < 8' infile
this should give me
2 Nah.
3 Oh, sir, it's only a tiny, little, thin one.
6 Look. I couldn't eat another thing. I'm absolutely stuffed. Bugger off.
7 Oh, sir, just-- just one.
So this example works. But this command:
awk '$1 > 10510000 && $1 < 12390000 || $1 < 2709520 || $1 > 57443438 || $1 > 20680000 && < 20930000'
gives me this:
awk: $1 > 10510000 && $1 < 12390000 || $1 < 2709520 || $1 > 57443438 || $1 > 20680000 && < 20930000
awk: ^ syntax error
Upvotes: 0
Views: 93
Reputation: 85795
Your second script is missing an operand exactly where the error message points too:
... || $1 > 20680000 && < 20930000
awk: ^ syntax error
This should be:
... || $1 > 20680000 && $1 < 20930000
Upvotes: 1
Reputation: 203655
Your posted script has a syntax error at the position indicated by the error message:
awk: $1 > 10510000 && ... || $1 > 20680000 && < 20930000
awk: ^ syntax error
because you have && < 20930000
instead of && $1 < 20930000
, assuming it's $1 you want to compare.
Upvotes: 3