2
votes
3answers
75 views

How to optimize this oneliner? (if second column empty, put the line in another file)

I have a little "oneliner": while read ONELINE; do if [[ -n "`echo $ONELINE | awk '{print $2}'`" ]]; then echo "$ONELINE" >> LIST-ok.txt else echo "$ONELINE" >> ...
3
votes
1answer
138 views

CPU is free, yet bash script not utilizing all CPU resources

I ran a simple script to generate a large (10000000 lines) csv file with 6 fields in which some fields changed in each line/row, using a while loop. The machine had all (32) CPUs free, lot of RAM (~31 ...
3
votes
4answers
208 views

Does cron jobs per se represent a significant burden on a modern system?

I'd like to run a pretty simple script (is there a dir with name x in dir y if so move it to dir z–and x will only be there about once a day) every 15 seconds or so (one minute divided into 4*15 ...
23
votes
9answers
900 views

for vs find in Bash

When looping through files there are two ways: 1. use a for-loop for f in *; do echo "$f" done 2. use find find * -prune | while read f; do echo "$f" done Assuming these two loops will ...
2
votes
1answer
144 views

How to have find only search for files in changed directories?

Currently I'm repeatedly doing a 'find' that's too slow. I'm searching for non-hidden executable files within "$root", excluding "$root/bin": find "$root" -type f -perm -o+x -not -path "$root/bin/*" ...
2
votes
3answers
3k views

Faster awk script to get the substring / string we wanted

ORDER EVENT .........[] [] ... so many other tags... [Account<25106>=ACCT1] [Destination...] .. so many other tags. I am currently trying to get the account like this. I tried using match in ...
23
votes
3answers
955 views

Should I care about unnecessary cats?

A lot of command-line utilities can take their input either from a pipe or as a filename argument. For long shell scripts, I find starting the chain off with a cat makes it more readable, especially ...