Never Mind!
spend the better part of the day looking for this only to find the answer right after i gave up.
was looking for sed to do this, bit it can be done a lot simpler like below
Quote:
for file in `ls -1 *`; do echo "<title>$file</title>" > ./tmpfile; cat "$file" >> ./tmpfile; mv ./tmpfile "$file"; done
Here is my code:
Code:
#!/bin/bash
parse_out |grep LX[0-9] > tmpfile
while read i
do
arr=($i)
string="ssh ${arr[0]} grep WARN logs/US/`echo ${arr[1]}|cut -d_ -f2,3,4|sed 's/_/\//'`/live.stdout"
echo $string
#eval $string
sleep 1
done < tmpfile
It works fine, but if i uncomment eval, it makes only once cycle in loop and then stops whithout any errors (exit code is 0). Why?
Hi guys,
I know computers don't misbehave.
But I'm puzzled by what's happening right know in a script :
I simplified the example to point out what seems weird to me.
Don't try to find any sense to this stupid script.
There are 10 rows in /tmp/tmp.txt
Code:
i=0
tmpfile=/tmp/tmp.txt
while read -r; do
echo "$REPLY" > /dev/null
sed "1,$((++i))d&qu
Hi,
I have a process which outputs to a log.
Below is the code snippet:
Code:
process &> $LOGFILE&
The log file keeps on updating whenever a transaction is processed.
I'm trying to do some stuff at logout, and the task can take up to 5 minutes to complete.
If the user chooses Power off or Reboot directly, the script is killed before completion.
Hi all
I was wondering if there was a slicker way of doing this without the file -
Code:
awk '{print $2}' FS=":" "${FILE}" > "${TMPFILE}"
{
read M_GRP_ID || m_fail 1 "Error: Read failed 1 (${FUNCNAME})"
read M_GRP_WAIT || m_fail 1 "Error: Read failed 2 (${FUNCNAME})"
} <
I would like to keep a log of files that I am writing to tape using dd or tar for each file. Then at the end of the run, prepend that log to the beginning of the tape using dd. If it works, I can see the contents of any tape by reading the first few blocks, and then use "mt fsf" to position the tape at the specified file.
I want to add $x/ from data formatted as $x-xyz (xyz is a mix of text and number to be ignored).
Example data
AB-10C
CD-02E
Output
AB/AB-10C
CD/CD-02E
How do I describe the variable as text before the hyphen?
Hello Mates
I am trying to write a script, which appends and prepends the text in a file.
I tried testing with a small file and it worked fine.
but for the large file, the script is wiping the entire file and adds only the word to be appended in the file.
Code:
mv $file_name $file_name.bak
sed -e "s/^/$prepend/g" $file_name.bak > $file_name
mv $file_name $file_name.bak1
sed -e