do it with "sed" rather. The "-i" switch has the "in-place" editing.
However if something goes wrong, you can backup the file . The "-i" switch has that facility.
This also create a backup of the original file in addition to doing your job file - file.bak
i want to redirect the grep output into the variable
but i am not able to get it
i tried
veri=`grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1`
vari=$(grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1)
BUT NOT... (1 Reply)
Hi,
I am writing the following code in command prompt it is working fine.
grep ',222,' SAPPCO_20080306.CSV_old > SAPPCO_20080306.CSV_new
But the command is not working in the Shell Script...
##########################################
#!/bin/sh
#... (2 Replies)
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
Hi all
i'm new in KSH,
i want to write a script to grep a logs files and redirecting the result into a relative subdirectory/file.txt that must be created near to each log file
my begin script is :
find ./logs -type f -name "*.log" -exec grep error {} \;
how i can perform that modest... (10 Replies)
When i use the command to check the preview of the filesets to be installed using CLI
# When using this commad 'm able to see all Preview view of the filesets to be installed
installp -apgX -d "." all
# When I redirected the same output to a file 'm able to see only half the details... (1 Reply)
Hi
can anyone tell me how to redirect the ouput of a cvs command to a file as well as the console?
i tried using
cvs add <filename> | tee logFile
cvs add <filename> 2>logFile 2>&1
All i could get is only on console or on file.
Please help
Thanks (2 Replies)
I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like,
echo "Runtimes for servlet 4, 100K structures" > test_times.txt
echo "" >> test_times.txt
echo "runs where N=10" >> test_times.txt
echo... (7 Replies)
(/home/user1)-> more script.sh
#!/bin/ksh
( echo open devicename
sleep 3;
echo user;
sleep 2;
echo password;
sleep 2;
echo "/info/dump"; ---------> This needs to redirect to a file .Can be number of pages
sleep 2;
echo "exit" ) | telnet
Please use code tags next time for... (2 Replies)
i have simple program that generate log file 1 line every sec, i need to do grep for specific record then redirect to another file.
#!/bin/bash
for i in `seq 1 20`;
do
echo $i
sleep 1
done
./test.sh |egrep "5|10|15"
5
10
15
r
./test.sh... (2 Replies)
I'm trying to find out what happened to the rogue game that apt-get told me it installed, so I thought I would find the file. I went to the root and entered:
find -name "rog*.*"
I get a large number of lines saying my access is denied in various directories. I figure I'll practice my Unix... (14 Replies)