05-14-2013
That's a shell keeper, and you can read N+ fields into N variables, you can change $IFS in the while subshell to change field dividers, it has low latency and no upper limit on lines processed. It works in bash, ksh, and who knows, maybe sh. Avoid "for f in `make_all_files`; do ... done". Bash has a read -a to load all fields into one predefined typedef array variable.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have this in my script:
DEBUG_DIR=/log/rotate_output
DEBUGLOG=${DEBUG_DIR}/rotate.${TIMESTAMP}
SERVER_FILE_LIST="\
wasint0206 /logs/squid_backup
wasint0201 /logs/squid_backup"
/usr/bin/echo "${SERVER_FILE_LIST}" | while read SERVER DIRECTORY
do
cd /log/squid_logs/${SERVER}... (2 Replies)
Discussion started by: LordJezo
2 Replies
2. Shell Programming and Scripting
Hello,
If I run a program from within shell, the output is displayed in the command line terminal. Is there a way I can capture that output and choose only the very last string in it to send it to a new file?
Thank you (6 Replies)
Discussion started by: Lorna
6 Replies
3. Shell Programming and Scripting
Hi All,
I'm trying to send some file which generated by script to my email. when I run the script I'm getting an email. Thats fine. But it seems to be all messed up like below
Memory Status on ServerA: Mem: 3867444k total, 862680k used, 3004764k free, 54456k buffers!! CPU Status on ServerA:... (4 Replies)
Discussion started by: s_linux
4 Replies
4. Shell Programming and Scripting
I am trying to delete all aliases from a specific location. so far i have:
rm -f `mdfind -onlyin /Users/steve/Desktop/Test 'kMDItemKind=Alias' /`
i thought this would delete all files that were Aliases using ItemKind, but it will not delete the files.
However, doing just mdfind -onlyin... (0 Replies)
Discussion started by: slindgre
0 Replies
5. Shell Programming and Scripting
From the command line I am running the following command:
for i in $(awk '{print ($1)}' src-dst|uniq); do dig -x "$i" +short; done
src-dst has a list of IP addresses. When this script is running and I do a ps -ef | grep dig, I see the proper dig command with IP addresses being run, but the... (2 Replies)
Discussion started by: phish
2 Replies
6. Shell Programming and Scripting
Hi Guys,
I am not Good at scripting.
I need to write a script such that if output of command shows the particular word in output then send mail to abc@compay.com
-bash-3.2$ ps -ef | grep bpbkar
root 6040 1 0 13:05:19 ? 0:00 bpbkar -r 2678400 -ru root -dt 47395 -to 0... (20 Replies)
Discussion started by: manalisharmabe
20 Replies
7. Shell Programming and Scripting
Hallo Friends,
I would like to compare two files, then write the difference between the two into output file then find a pattern then search for that pattern.
-bash-3.2$ cat BS_Orig_20141112.csv|head -20
BW0159574451211141638275086@196.35.130.5
BW02043750712111491637691@196.35.130.5... (2 Replies)
Discussion started by: kekanap
2 Replies
8. Shell Programming and Scripting
I am measuring the time it takes for a wget command to complete.
Right now my command is:
time wget https://`ifconfig -a | grep '32.29.120' | cut -d: -f2 | cut -d' ' -f1`:8443/primary-rest/shop?brandId=test --header="name: test" --no-check-certificate -o SELF_TEST.log
The output I get is ... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies
9. Shell Programming and Scripting
Hi Guys,
I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies
10. Shell Programming and Scripting
Hello Team .
I am working a health check script ( bash) to run on linux server ( RedHat) and requirements are
1. The o/p of script need to be send to two diff files . I am testing with tee command . But I am not successful yet , any recommendations if that is the right approach ?
2. The same... (2 Replies)
Discussion started by: Varja
2 Replies