Hello - Have a big issue need help please ASAP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Hello - Have a big issue need help please ASAP
# 8  
Old 04-04-2011
ctsgnb - thx It looks like its working .. tring t ounderstand the code
can u please explian?
# 9  
Old 04-04-2011
Quote:
Originally Posted by mnassiri
ctsgnb - thx It looks like its working .. tring t ounderstand the code
can u please explian?

Code:
# awk '/ALPHANUMERIC/&&$(NF-2)>27&&$(NF-2)<256' infile

NF is the total number of fields of the line that is currently scanned (by default, awk will consider every succession of one or more blank character (mainly space & tab) as 1 separator between 2 fields.
$NFrefer to the value of the last field
$(NF-1)refer to the value of field NF-1
$(NF-2)refer to the value of field NF-2
/ALPHANUMERIC/select lines that contains the pattern "ALPHANUMERIC"
&& logical AND condition
$(NF-2)>27 select lines whose field NF-2 has a value greater than 27
$(NF-2)<256 select lines whose field NF-2 has a value lower than 256
The default action will be to print the lines that matched the specified conditions

You can get more info here
This User Gave Thanks to ctsgnb For This Post:
# 10  
Old 04-04-2011
Gtsgnb

SmilieSmilieSmilie

Thanks for the explaination.
Sorry for delayed response - Got tide up - But this was really helpful !!
I Appreciate it very much>

Lat question:

Within the same command would it possible to "sort" by the length defined for the alphanumeric field ?
# 11  
Old 04-04-2011
Code:
nawk '/ALPHANUMERIC/&&$(NF-2)>27&&$(NF-2)<256 {print $(NF-2),$0}' infile | sort -k1n,1 | cut -d ' ' -f2-

# 12  
Old 04-04-2011
Quote:
Originally Posted by mnassiri
corona688 the code u provided that goes inside a script
The complete English sentence? I don't understand what you want.

"u" is not a word, either.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete big directory issue

Hello folks, I am deleting a directory with script it is taking 11Hour and also increase the IO on server. I am using below command, inside date directory there are hour directories, which i am deleting after archiving. Archiving is not taking long time, only "rm -rf" is taking alot of time with... (21 Replies)
Discussion started by: learnbash
21 Replies

2. Solaris

Big /etc/group creating issue

I have Solaris-10 with kernel patch 142900-03, Update 7 Sparc server. root@ddlomps40:/# uname -a SunOS ddlomps40 5.10 Generic_142900-03 sun4u sparc SUNW,SPARC-Enterprise root@ddlomps40:/# cat /etc/release Solaris 10 5/09 s10s_u7wos_08 SPARC Copyright 2009 Sun... (5 Replies)
Discussion started by: solaris_1977
5 Replies

3. Red Hat

NFS4 Mount issue - ASAP

Hi, I am trying to mount via nfs4 # mount -t nfs4 10.1.56.16:/Apps /works/apps/xyz Error: Warning rpc.idmapd apperas not to be running all uids will be mapped to the nobody uid mount to NFS server "10.1.56.16' failed RPC error: program/version mismatched pls help - this is coming... (1 Reply)
Discussion started by: saurabh84g
1 Replies

4. Homework & Coursework Questions

PLEASE HELP ME ASAP

can anyone help me with this??? make program ( shell script) to detect and display errors occurred in initializing a Unix system (4 Replies)
Discussion started by: dementor
4 Replies

5. UNIX for Dummies Questions & Answers

How big is too big a config.log file?

I have a 5000 line config.log file with several "maybe" errors. Any reccomendations on finding solvable problems? (2 Replies)
Discussion started by: NeedLotsofHelp
2 Replies

6. Shell Programming and Scripting

need help asap!

Hello everyone, I'm new to using Linux and i am trying to create a script that will produce a list of all the files of the present working directory. So far I only have this #!/bin/bash cd / ls -lt>> I can't figure out what I am suppose to do next. (6 Replies)
Discussion started by: reecygee
6 Replies

7. Shell Programming and Scripting

need help asap

i have a file having content a|b|c 1|2|33 4|6|55 end a|b|d 3|4|55 end a|b|c 45|67|98 end so i want to print 3rd field of header a|b|c and footer end. e.g. o/p should be 33 55 98 (7 Replies)
Discussion started by: manas_ranjan
7 Replies

8. UNIX for Dummies Questions & Answers

How to view a big file(143M big)

1 . Thanks everyone who read the post first. 2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too. How to view it ? If I want to view 200-300 ,how can I implement it 3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies
Login or Register to Ask a Question