Search Results

Search: Posts Made By: sighK
5,503
Posted By sighK
try this
# For multiple files
perl -pi -e 's/searchterm/replaceterm/' *.txt

#for single file
perl -pi -e 's/searchterm/replaceterm/' myfile.txt
2,410
Posted By sighK
??
who would the file contain the result of echo "Result: $?" then? it shouldnt have anything in the log if it failed, the failure was from within the script.

---------- Post updated at 05:46 PM...
1,889
Posted By sighK
don't use $/ try reading whole thing as a...
don't use $/

try reading whole thing as a string, use split to get whwat you need instead

$/ is for cutting streams. It isn't even a string until you place it into a register.
or use it to...
19,173
Posted By sighK
try
for (( i=$COUNTER; $i > 0; )); do
echo $i
let i-=1
done

I hope this helps
19,173
Posted By sighK
while [ "$COUNTER" != "0" ] it never...
while [ "$COUNTER" != "0" ]


it never reaches 0, so it has nothing left to do but a continuous loop of nothing, you need to break at somepoint

It should be in a for loop instead of while.
...
13,523
Posted By sighK
try
try these

for i in `seq 0 365`; do
echo $i
done

or

seq 0 365|while read line; do
echo $line
done
19,173
Posted By sighK
finish
try cp -R instead of just cp

cp -R will copy subdirs also
19,173
Posted By sighK
try #!/bin/bash ls|head -3|while read...
try

#!/bin/bash
ls|head -3|while read line; do
cp "$line" "./folder1/"
cp "$line" "./folder2/"
cp "$line" "./folder3/"
rm "$line"
done
19,509
Posted By sighK
sure
cat dumps entire file to output

| is a pipe to push into another application's stdin

grep -i -e

-i removes case

-e "string to search for"

I pipe it into another instance of grep to...
4,342
Posted By sighK
hint
man ftp
man sendmail
man bash
19,509
Posted By sighK
try this instead #!/usr/bin/perl $i=0; ...
try this instead

#!/usr/bin/perl

$i=0;
while ( $i eq 0 ){
$line=<STDIN>;
$line=~ s/\n//g;
$line=~ s/\r//g;
($a, $b, $c, $d, $e, $f) = split ("|", $line);
if ( "$d" eq "ffff" ){
if ( "$a"...
3,150
Posted By sighK
simple
it looks like you will use your script as

cat $file|yourscript.ksh

so I took the main loop of your script, encapsulated it into a function within the script

I then have it read every line,...
3,150
Posted By sighK
resolve
#!/bin/ksh
C="/apps/scripts/Test/"
cd $C
b="username"
c="password"
d="enablepassword"
ulimit -nS 1024


mainloop(){
while read ROUTER EIGRPNEI PROBLEMCOUNT
do
${C}report.exp $ROUTER $b...
Showing results 1 to 13 of 13

 
All times are GMT -4. The time now is 04:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy