how to print the value > 1000 in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to print the value > 1000 in a file
# 1  
Old 08-02-2012
how to print the value > 1000 in a file

if the file test include

1233
0.123
0.128
0.165
0.14
14.5
134556
48968

can i show the output value > 1000 by command grep or awk or...?

1233
134556
48968


Thank you.

---------- Post updated at 09:55 PM ---------- Previous update was at 09:48 PM ----------

fixed.
# 2  
Old 08-02-2012
try this.....

Code:
awk '$0 > 1000{ print;}' file_tmp
1233
134556
48968

# 3  
Old 08-02-2012
Code:
awk '$0>1000{print > "out.txt"}' input.txt

# 4  
Old 08-02-2012
Code:
awk '$0>1000' inputfile

# 5  
Old 08-02-2012
Code:
egrep '^[1-9][0-9]{3}' file

# 6  
Old 08-02-2012
Quote:
Originally Posted by balajesuri
Code:
egrep '^[1-9][0-9]{3}' file

That will print lines starting with 1000 too.
# 7  
Old 08-02-2012
thank you.SmilieSmilieSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract a column and multiple by 1000 and replace it on same file

Hi All, I need to extract a position in the file and multiple the value by 1000 and the replace it . Original 0010001200084701217637306521200000000000010010000000 ---> 000847 * 1000 0010012700086001213437404323000000000000001001000000 ---> 000860 * 1000... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

2. UNIX for Dummies Questions & Answers

Split files into smaller ones with 1000 hierarchies in a single file.

input file: AD,00,--,---,---,---,---,---,---,--,--,--- AM,000,---,---,---,---,---,--- AR, ,---,--,---,--- AA,---,---,---,--- AT,--- AU,---,---,--- AS,---,--- AP,---,---,--- AI,--- AD,00,---,---,---, ,---,---,---,---,---,--- AM,000,---,---,--- AR,... (6 Replies)
Discussion started by: kcdg859
6 Replies

3. Shell Programming and Scripting

Automated script to take 1000 records from the file every week.

I have a file having n number of records .i want first 1000 records from the file and store in temporary file to process on sunday. I want script should should automatically take the next 1000 records for processing on next sunday. can we do it using head and tail head -1000 | tail... (2 Replies)
Discussion started by: sonam273
2 Replies

4. Shell Programming and Scripting

Script to find the string contain in which file 1000 files.

Hi Greetings i have 1000 files (xmlfiles) and i need to find which file contain the string over 1000 file all file end with txt i tried with grep -c "string" *.txt i am getting an error -bash: /bin/egrep: Argument list too long i have put an script like below #!/bin/bash for line... (9 Replies)
Discussion started by: venikathir
9 Replies

5. Shell Programming and Scripting

Find more then 1000 file at a time

Dear All, The need to found more than 1000 file are available in particular directory or not .That more than 1000 file stored in file.txt . i tried with locate & find command .But i can't get.pls post if any other option (1 Reply)
Discussion started by: kpoobathi
1 Replies

6. Shell Programming and Scripting

To call a Oracle sql file 1000 times

Hi Guys, Even though, i have called db2 sql file earlier, this is my first time to call a oracle sql file. I need to make a database(oracle) connection and then call the sql file in a loop. Can you please help me out. Thanks for your help and time. Regards, Magesh (4 Replies)
Discussion started by: mac4rfree
4 Replies

7. Shell Programming and Scripting

retain last 1000 line in a file

I have large file with around 100k+ lines. I wanted to retain only the last 100 lines in that file. One way i thought was using tail -1000 filename > filename1 mv filename1 filename But there should be a better solution.. Is there a way I can use sed or any such command to change the... (9 Replies)
Discussion started by: nss280
9 Replies

8. Shell Programming and Scripting

Howto Print File Path or Print the Filename

I'm trying to clean up my samba share and need to print the found file or print the path of the image it tried to searched for. So far I have this but can't seem to get the logic right. Can anyone help point me in the right direction? for FILE in `cat list`; do if ; then ... (1 Reply)
Discussion started by: overkill
1 Replies

9. UNIX for Dummies Questions & Answers

Want to process file in 1000 record increments

I have a file that varies in the # of records. I want to read 1000 records, do something, read the next 1000 records, do something, going in 1000 increment chunks, and then finish up with whatever is left over at end of file. (1 Reply)
Discussion started by: Tsamp
1 Replies

10. UNIX for Dummies Questions & Answers

How to extract many lines from a file, typically the 1000 last

Hello! Is it anyone who might know how to extract the n last lines from a file, typically the 1000 last? Until know I have used sed -n np filename, but it takes each line separately, and is hence very time consuming. Thank you in advance! (3 Replies)
Discussion started by: kingkong
3 Replies
Login or Register to Ask a Question