Sponsored Content
Top Forums Shell Programming and Scripting awk & basename puzzler - advise sought Post 302730861 by agama on Tuesday 13th of November 2012 08:12:07 PM
Old 11-13-2012
First of all, you don't need to cat into a while, you can redirect the file into the while:

Code:
while read stuff
do
   echo $stuff
done <$ELOG

Further, the use of awk isn't needed either. Something like this should work, provided you actually can supply your encryption password as you indicated on the command line:

Code:
while read source dest
do
    ENCRYPT ${source##*/} "password"
    sleep 3
    mv $source $dest
done <$ELOG


Last edited by agama; 11-13-2012 at 09:13 PM.. Reason: missing word
This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Spammers: Advice being sought

The Web-based contact form on my site has been under distributed spamming attacks for nearly a month already. Obviously, a spammer has tried to generate HTTP requests containing ads to male drugs and all sorts of similar stuff directly to the form mail processor script on my site using a robot, as... (5 Replies)
Discussion started by: cbkihong
5 Replies

2. Shell Programming and Scripting

Using find command with awk or basename

Hi, I am using the following command to extract any log files that are older than 3 days using the following command. find DIR/LOGDIR -type f -mtime +3 |grep LOG > log_list.out The results are DIR/LOGDIR/1.LOG DIR/LOGDIR/2.LOG DIR/LOGDIR/3.LOG DIR/LOGDIR/4.LOG How do inculde (basename... (4 Replies)
Discussion started by: sam_78_nyc
4 Replies

3. Shell Programming and Scripting

getting basename inside awk script

hi if we have to use basename how can we do this in awk? did the below but is not working.. psg -t "?"| awk '{ command=($5 ~ /^/)? $9:$8 # cmd_name=`basename $command` (gives error) system("basename $command >>... (10 Replies)
Discussion started by: Anteus
10 Replies

4. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

5. Shell Programming and Scripting

extracting basename in awk or nawk

I am having a hard time extracting the file name from the above code. Instead of printing /folder/file.1$.5$, I would like it to print the file name file.1$.5$. I have tried using basename but it looks like NAWK or AWK does not recognise basename. Each time I type it in, it prints out the word... (4 Replies)
Discussion started by: asemota
4 Replies

6. Shell Programming and Scripting

Need advise to process the file with awk

Hi gurus, i need your advise on how to process this file using awk. i have this file COLA COLB COLC COLD COLE COLF COLG COLH AAAA 86 111 122 133 144 155 266 377 BBBB 70 211 222 233 244 255 266 ... (6 Replies)
Discussion started by: ablanc
6 Replies

7. UNIX for Dummies Questions & Answers

awk and basename

im trying to extract the basename of a process running on a host processx is running at host1 as /applications/myapps/bin/processx i wanted to check if its running, then extract the basename only using: $ ssh host1 "ps aux | grep -v 'grep' | grep 'processx'" | awk '{ print basename $11}' ... (10 Replies)
Discussion started by: kaboink
10 Replies

8. Shell Programming and Scripting

korn shell script puzzler

Here is a very simple Korn shell script running on an AIX 5.3 box. Why does this work without the $ prepended to RET_CD? #!/bin/ksh RET_CD=0 if && then echo "RET_CD is not 0 and not 2" else echo "RET_CD is a 0 or a 2" fi (3 Replies)
Discussion started by: beldar
3 Replies

9. Shell Programming and Scripting

Solaris script using awk giving errors - please advise

I'm using solaris 10 Scenario as follows I have a logfile with 2 columns: column 1 = source directory + filename column 2 = destination directory + filename Using cron, my script polls for new files and adds them to the logfile ($ELOG) as described above. Using sed, the distination... (2 Replies)
Discussion started by: davidra
2 Replies

10. Shell Programming and Scripting

awk Help: quick and easy question may be: How to use &&

Hi Guru's. I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 : awk '{ if ($5>80) && if ($5 != 100) print $0} But getting error: >bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}' syntax error The source line is 1. The error... (6 Replies)
Discussion started by: rveri
6 Replies
BASENAME(3)								 1							       BASENAME(3)

basename - Returns trailing name component of path

SYNOPSIS
string basename (string $path, [string $suffix]) DESCRIPTION
Given a string containing the path to a file or directory, this function will return the trailing name component. PARAMETERS
o $path - A path. On Windows, both slash ( /) and backslash ( ) are used as directory separator character. In other environments, it is the forward slash ( /). o $suffix - If the name component ends in $suffix this will also be cut off. RETURN VALUES
Returns the base name of the given $path. EXAMPLES
Example #1 basename(3) example <?php echo "1) ".basename("/etc/sudoers.d", ".d").PHP_EOL; echo "2) ".basename("/etc/sudoers.d").PHP_EOL; echo "3) ".basename("/etc/passwd").PHP_EOL; echo "4) ".basename("/etc/").PHP_EOL; echo "5) ".basename(".").PHP_EOL; echo "6) ".basename("/"); ?> The above example will output: 1) sudoers 2) sudoers.d 3) passwd 4) etc 5) . 6) NOTES
Note basename(3) operates naively on the input string, and is not aware of the actual filesystem, or path components such as " ..". Note basename(3) is locale aware, so for it to see the correct basename with multibyte character paths, the matching locale must be set using the setlocale(3) function. SEE ALSO
dirname(3), pathinfo(3). PHP Documentation Group BASENAME(3)
All times are GMT -4. The time now is 03:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy