awk online to exclude rows


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers awk online to exclude rows
# 1  
Old 07-16-2014
awk online to exclude rows

Hello,

I have 3 columns like shown below:

Code:
1	1800	1900
2	1765	1900
3	1654	2054
4	1326	1499
5	1540	1765

I want only those rows where column 2 and column 3's values don't fall within 1800-1900 both inclusive.

My output should only be:
Code:
4	1326	1499
5	1540	1765

Is there a quick awk command that can do this? Thanks for your input!
~Guss
# 2  
Old 07-16-2014
1654 is not in the range [1800-1900] and 2054 is not in the range [1800-1900]. So, why isn't:
Code:
3	1654	2054

included in the desired output?
# 3  
Old 07-16-2014
Oops! I forgot to mention that col2 and col3 represent a range with min and max. Therefore [1800-1900] falls between the min and max for 1654 and 2054 and should be excluded.

~Guss
# 4  
Old 07-17-2014
Try:
Code:
awk '$2>1900 || $3<1800' file

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract and exclude rows based on duplicate values

Hello I have a file like this: > cat examplefile ghi|NN603762|eee mno|NN607265|ttt pqr|NN613879|yyy stu|NN615002|uuu jkl|NN607265|rrr vwx|NN615002|iii yzA|NN618555|ooo def|NN190486|www BCD|NN628717|ppp abc|NN190486|qqq EFG|NN628717|aaa HIJ|NN628717|sss > I can sort the file by... (5 Replies)
Discussion started by: CHoggarth
5 Replies

2. Shell Programming and Scripting

Exclude First Line when awk

Hi there, Where do I add the !NR==1 into the awk statement such that it ignores the first line . awk '/1.2 Install/ {P=0} /1.1 Apply/ {P=1} P {print FILENAME, $0} ' solarisappsummary.txt solarisdbsummary.txt solaris_websummary.txt (12 Replies)
Discussion started by: alvinoo
12 Replies

3. UNIX and Linux Applications

Online insert MySQL rows by perl-script

Hello, Met a problem when I tried to insert rows to MySQL database from an old book that fits my learning level (MySQL and Perl for the Web, by Paul DuBois, 2001). First, under mysql console I created a database: webdb and the table: todo. Then I draft the perl-cgi script to have online page.... (0 Replies)
Discussion started by: yifangt
0 Replies

4. Shell Programming and Scripting

AWK exclude first and last record, sort and print

Hi everyone, I've really searched for a solution to this and this is what I found so far: I need to sort a command output (here represented as a "cat file" command) and from the second down to the second-last line based on the second row and then print ALL the output with the specified section... (7 Replies)
Discussion started by: dentex
7 Replies

5. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies

6. Shell Programming and Scripting

awk and sed, how to exclude certain characters

Hello everyone: I have ran into this a few times now where my skills are just not up to snuff when it comes to Unix. So, I came here to find some beard stroking Unix wizard to help me. Basically, I am using OS X 10.5 in large scale at work and sometimes I have to run some custom reports. ... (5 Replies)
Discussion started by: tlarkin
5 Replies

7. Shell Programming and Scripting

how to exclude the header in shell script using awk

Hello Everyone In my shell script, I am retrieving the cluster ID and node number of an LPAR using the following command - lsclcfg -l This command's output looks as follows - CLUSTER_NAME CLUSTER_ID NODE_NR sch1h004 6104567 3 I want to store only the... (3 Replies)
Discussion started by: gates1580
3 Replies

8. Shell Programming and Scripting

How to print more than online using awk

Would you please help me on formatting the following lines of information. Input file: -- appl = host = user = / pid = 76 elapsed = 0.000 seconds server_elapsed = 0.000 select emp_no, dept_no from emp where empname like 'Rob%' ; -- appl = host = user = / pid = 76 elapsed =... (10 Replies)
Discussion started by: newlearner
10 Replies

9. UNIX for Dummies Questions & Answers

Is there online help for awk programming

Can anybody please supply me with a good url to get online help to awk programming, with good examples. Yes I've taken that big step in trying to master 'awk' after being able to avoid it for the last couple of years :-) Failing that, is there any good books I can get instead. Many thanks... (4 Replies)
Discussion started by: cfoxwell
4 Replies
Login or Register to Ask a Question