![]() |
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 |
| How to build a command into a string rather than execute the command | littlejon | Shell Programming and Scripting | 1 | 05-29-2008 08:05 PM |
| to execute the command swlist | vivek_damodaran | HP-UX | 6 | 11-09-2007 05:56 PM |
| Plz Help : How to use write command to execute command on some other terminal | Aashish | UNIX for Dummies Questions & Answers | 2 | 03-03-2006 12:25 PM |
| How does this command execute? | saneeshjose | UNIX for Dummies Questions & Answers | 3 | 01-03-2006 10:46 AM |
| execute command | neer45 | Shell Programming and Scripting | 2 | 11-25-2001 08:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
awk and execute command ???
If I have a flat file date.txt separate by a tab
date1 date2 count 20060226 20060225 2 20060227 20060226 2 20060228 20060227 5 20060314 20060228 2 20060315 20060314 1 If $3 (count) is 5 then execute the script testit.ksh with $1=20060228 , using script testit.ksh 20060228 and if $3 is 5 then $2=20060227 and move files *.20060227.* to /DAT2/ cat date.txt | awk '{ if ($3 == 5) { ./testit.ksh $1 ???? mv *.$2.* /DAT2/ } }' This is a stupid code but I just want to learn what you do with awk and command .Thanks for teaching me. |
|
|||||
|
Quote:
have looked at/tried the posted suggestion? Last edited by vgersh99; 03-28-2006 at 12:31 PM.. |
|
||||
|
Hi vgersh99,
Because this myFile.txt have along list and I am sure it have cnt is = 5, then take that $1 is d1 at $2 is d2. So I update your code like this but it copy every thing to DATA2 directory and somehow it can not execute the testit.ksh. Any idea ? #!/bin/ksh while read d1 d2 cnt do (( cnt = 5 )) && testit.ksh "${d1}" (( cnt = 5 )) && cp *.${d2}.* /DAT2/ done < myFile.txt |
|
|||||
|
Quote:
also is your 'testit.ksh' has the 'execute' bit turned on? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|