![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| parsing output from SQL querry | ludvig | Shell Programming and Scripting | 7 | 10-23-2007 05:42 AM |
| parsing output from a diff command... | kam | Shell Programming and Scripting | 5 | 05-29-2007 11:26 PM |
| problem parsing output file | ragha81 | Shell Programming and Scripting | 13 | 03-21-2007 02:06 PM |
| problem parsing process-output | victorin | Shell Programming and Scripting | 3 | 07-25-2006 05:31 AM |
| HTTP Query Request & Parsing returned XML output | jerardfjay | Shell Programming and Scripting | 15 | 05-18-2005 09:25 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
parsing output from ls command
I have to test the directory name which is obtained from
for dir in `ls -l|grep $9 ' i need to check whether it is directory ( [ -d dir ] if yes, I have to check the first 3 character fo the directory how can I do that? Please help me thanks |
|
||||
|
Quote:
to list dirs ls -l | grep ^d what abt this ? Quote:
If possible with an example. |
|
||||
|
firt I have to find the directory in a directory
ls -ld */ will do it once I find it is directory, I have to check the first 3 character of the directory drwxr-xr-x 2 mqm mqm 512 Jan 20 09:36 DQAT001/ drwxr-xr-x 3 mqm mqm 512 Jan 25 12:38 DQAT004/ drwxr-xr-x 2 mqm mqm 512 Apr 20 07:55 DQAT0040/ drwxr-xr-x 2 mqm mqm 512 Apr 20 10:31 DQAT0041/ drwxr-xr-x 2 mqm mqm 512 Jul 13 2005 DQAT005/ drwxr-xr-x 2 mqm mqm 512 May 2 09:33 DQBT007/ in the above I have to find certain directory which has first three character say ' DQA' how i can check the first three character in the "DQAT001/" i hope you understand thanks |
|
||||
|
more clearly I am trying to like this
for i in ` ls -ld */ |awk '{print $9}'| awk -F \/ '{print $1}'` ; do awk $i~/^DQA/ ' { log for processing goes here }' done when i find directoy, then i need to see first three character of $i and if matches, process thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|