Search Results

Search: Posts Made By: siva shankar
3,902
Posted By siva shankar
coz, sed and rm commands are not separated using...
coz, sed and rm commands are not separated using ';' and sed is thinking rm and -rf to be the input files and searching for them in current directory...
:)
3,902
Posted By siva shankar
sorry n updated... try it...
sorry n updated...
try it...
3,902
Posted By siva shankar
Try this... find...
Try this...
find /Users/username/Desktop/convert/ -name "Object.obj" -type f -exec sh -c '\
sed "s!\o primary*!g primary!" {} | sed "s!\o secondary*!g secondary!" > `dirname {}`/Object2.obj; \
rm...
4,063
Posted By siva shankar
in ur snippet change as below echo $linexT |...
in ur snippet change as below
echo $linexT | sed 's/^[ \t]*//g;s/[ \t]*$//g'

if u need one liner
echo $linexT | sed 's/^[ \t]*//g;s/[ \t]*$//g;s/,$//g'

else
sed 's/^[ \t]*//g;s/[...
4,063
Posted By siva shankar
ur code will work fine for spaces not for tabs,...
ur code will work fine for spaces not for tabs, can u give us some i/p, expected and obtained o/p.
2,482
Posted By siva shankar
Hi balajesuri, Did u tried this command ...
Hi balajesuri,

Did u tried this command
grep "^[ \t]*ALTER" input
as when i tried it in my Linux machine its not giving the lines with tab...
2,482
Posted By siva shankar
hi balajesuri, grep "^ *ALTER TABLE"...
hi balajesuri,

grep "^ *ALTER TABLE" inputfile

The above command will only search only for lines which have 0 to n spaces followed by the PATTERN and neglect if the PATTERN is after tab...
2,482
Posted By siva shankar
u can use sed and grep combination, sed...
u can use sed and grep combination,

sed 's/^[ \t]*//g;' filename | grep "^ALTER TABLE"

This will remove all tabs and spaces at starting and then match...
2,482
Posted By siva shankar
Try grep "^ALTER TABLE" filename
Try

grep "^ALTER TABLE" filename
2,270
Posted By siva shankar
I hope this will work... cat replace.sh ...
I hope this will work...

cat replace.sh
sed -i 's|#/bin/chk_env.sh|/bin/chk_env.sh|g' $1
grep -l '/bin/chk_env.sh' $1
if [[ $? != 0 ]]
then
echo "/bin/chk_env.sh" >> $1
fi

find ....
2,148
Posted By siva shankar
Another simple shell script awk '{ if($1...
Another simple shell script

awk '{
if($1 != "") {
if($1 == "Question:") {num=$2}
else if ($1 == "Options:") {print ""}
else {printf "%s %s", num, $0; num=""}
}
}' infile
5,719
Posted By siva shankar
A small script for the same, echo "Enter...
A small script for the same,

echo "Enter date[MM/DD/YYYY]:"
read datee
day=$(date -d $datee +%u)
num=`expr 7 - $day`
x="date -d '$datee $num days'"
eval $x
num=`expr $day - 1`
x="date -d...
5,719
Posted By siva shankar
If u have -d option, u can use it date -d...
If u have -d option, u can use it
date -d '12/22/11' +'%u'
1,904
Posted By siva shankar
using sed, sed ':a;N;$!ba;s_]\n__g'...
using sed,
sed ':a;N;$!ba;s_]\n__g' <filename>
1,824
Posted By siva shankar
Try this... sed 's/,[^ ]/ /g; s/d$//g' 1 |...
Try this...

sed 's/,[^ ]/ /g; s/d$//g' 1 | awk '{
total[$3]+=$NF;
count[$3]++;
max[$3]=(max[$3]<$NF)?$NF:max[$3];
} END {
for (x in total) {print x,total[x]/count[x],max[x]?max[x]:0}
}'
3,573
Posted By siva shankar
There are many ways in shell... Ex: cat...
There are many ways in shell...

Ex:
cat id_file
id1
id2
id3

cat sample.sh
while read line
do
echo $line
done

cat id_file | ./sample.sh
or

./sample.sh < id_file
or
5,557
Posted By siva shankar
Try this snippet... sed -n '/CREATE TABLE...
Try this snippet...

sed -n '/CREATE TABLE \`$table_name1\`/,/^ENGINE/w tablextract2.sql}' testdump2.sql
5,557
Posted By siva shankar
I think this option might help u... -n,...
I think this option might help u...

-n, --quiet, --silent
suppress automatic printing of pattern space
Forum: Programming 12-08-2011
2,714
Posted By siva shankar
Hi friend, The code is not only for...
Hi friend,

The code is not only for n=0, its in a for loop. Let me explain with an example.

If s contain a string "5270", then the loop continue for 4 times:

1st : 10*0 + 5 = 5
2nd :...
2,099
Posted By siva shankar
I think this is the continuation of the below...
I think this is the continuation of the below question. Can I know y u created new thread and what u did to insert new lines??
...
9,679
Posted By siva shankar
Replace 10! with $!, sed...
Replace 10! with $!,

sed ':a;N;$!ba;s/eDir.*, 70.0/Hostname,Interface,Number of Errors,Bandwidth Utilization/g' file_name
2,669
Posted By siva shankar
can u show us the cmd u used and error it showed??
can u show us the cmd u used and error it showed??
2,669
Posted By siva shankar
u can use -i option of sed...
u can use -i option of sed...
2,669
Posted By siva shankar
hmmmm I hope it will not work... sed is...
hmmmm
I hope it will not work...

sed is used to modify or delete a line,
2,669
Posted By siva shankar
u can do it with sed command, check the man page...
u can do it with sed command, check the man page and show us what u tried...
Showing results 1 to 25 of 45

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