Numerical Decision


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Numerical Decision
# 1  
Old 10-08-2005
Numerical Decision

I'm tryning to do something like this,

I have this file:
spaces12tabgoodbye
spaces3tabhello

I want to copy to another file the lines that have the number above 10...

I thought using sort -rn but I don't know how to discard the lines that have the number below 10.

Any idea?

Thanks
# 2  
Old 10-08-2005
Try:
awk '$1>10' < inputfile > anotherfile
# 3  
Old 10-09-2005
That was what I wanted to do. Thanks.

Another question, is it possible to do something like this in a shell script? If not how can I do? I've already tried this, but didn't worked....

for i in 5 10 15 20
do
awk '$1>i' <inputfile >outputfile
done

I've already tried with a for inside the awk, but it still didn't worked.

Thanks in advance
# 4  
Old 10-09-2005
awk '$1>lim' lim=$i < inputfile > anotherfile
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Decision based on field value

Hi, I need to change the 3rd field value based on the 4th field value using a shell script. here are the fields; 05:15-23:59; 05:15-21:00; 11:00-18:00; TGSI; TGSummaryInfo_C ; ENTER VALID GAC 05:15-23:59; 05:15-21:00; 11:00-18:00; TGSI; TGSummaryInfo_E ; ENTER VALID GAC 05:15-23:59;... (4 Replies)
Discussion started by: sam_bd
4 Replies

2. Shell Programming and Scripting

Read section of file and take decision

Hi, My requirement is that I've to read a config file having below info Oracle number|double;integer -> user can put multiple values here blob|binary varchar2|string varchar|string number(p,s)|decimal timestamp|date/time and so on .... Sybase bigint|bigint datetime|date/time... (2 Replies)
Discussion started by: dips_ag
2 Replies

3. Shell Programming and Scripting

Query on decision making...

is_number() { echo $1|egrep '^*$' 2>&1 1>/dev/null return $? }why the following snippet always give an output as "no" and never "yes" whatever the parameter I give to function is_number? if ]; then echo yes; else echo no; fi In addition, the function is_number() is... (5 Replies)
Discussion started by: biglau
5 Replies

4. UNIX for Dummies Questions & Answers

Platform decision

Hi folks First, let me apologize in advance for the long message. I know this will sound like a typical "newbie" message but I am really working to understand the technology in order to make informed decisions. I am currently in the process of evaluating Unix hardware and OS platforms for an... (5 Replies)
Discussion started by: Scooter
5 Replies

5. News, Links, Events and Announcements

WIPO Official Decision

At Last Official Decision of UNIX.com Domain dispute by WIPO is available to review. http://arbiter.wipo.int/domains/decisions/html/2002/d2002-0294.html (Status: unix.com > Complaint denied) (1 Reply)
Discussion started by: killerserv
1 Replies

6. Shell Programming and Scripting

decision, case, it then else?

I'm writing this script in Korn Shell, on AIX. The script will print a log file, and it needs to decide what region it's in before printing. ( the output of db2 "get instance" is either "The current database manager instance is: db2q" or "The current database manager instance is: db2u") ... (6 Replies)
Discussion started by: jpprial
6 Replies
Login or Register to Ask a Question