Search Results

Search: Posts Made By: chella
3,436
Posted By chella
Awk regular expressions
Hi Experts,

Can you please help me out for the below scenario,

I have a variable length file with the fixed number of columns, in which the fields are delimited by pipe symbol (|). From that...
1,949
Posted By chella
Hi, Here is a small suggestion for your...
Hi,

Here is a small suggestion for your question,

Sort the file and use the tail command to take the greatest one and add 1 to it.

Hope this helps you.

Regards,
Chella.
46,627
Posted By chella
read a file line by line in ksh
Hi,

In ksh we use 'while read line' statement to read a file line by line. In my input file I have 5 spaces appended at the end of each line. When I use while read line statement it chops off the...
3,735
Posted By chella
Using sed
Hi,

inpt.txt

update table_name set a=10 where i=50
update table_name set b=10 where j=25
update table_name set c=40 where k=60


Try this sed command,

sed G inp.txt | sed 's/^$/go/g'
...
6,201
Posted By chella
Hi, Try this for the above scenario, ...
Hi,

Try this for the above scenario,

paste -sd# inp.txt | sed 's/#,/,/g;s/,#/,/g' | tr '#' '\n'

Regards,
Chella
6,201
Posted By chella
another way
Hi,

Try this for the above scenario

paste -sd# inp.txt | sed 's/#,/,/g' | tr '#' '\n'

Regards,
Chella
10,831
Posted By chella
How about this, sed 's/prod/devl/2' filename...
How about this,

sed 's/prod/devl/2' filename

Regards,
Chella
4,009
Posted By chella
Using Sed
Hi,

Try this

sed 's/></>\[press Enter(newline)]
</g' filename

Regards,
Chella
4,804
Posted By chella
Hi, Try this script, hope it helps you ...
Hi,

Try this script, hope it helps you

tr "," "\n" < inp.txt > temp1.txt
sed -e '/ /s/^\"//g;/ /s/\"$//g' -e 's/ /_/g' temp1.txt > temp2.txt
paste -sd, temp2.txt
rm temp1.txt temp2.txt

...
8,854
Posted By chella
Hi, Try this, sed '/reset/s%^%//%g' ...
Hi,

Try this,

sed '/reset/s%^%//%g'

Regards,
Chella
3,091
Posted By chella
Hi, Instead of using '/' as a seperator use...
Hi,

Instead of using '/' as a seperator use '-'

sed "s-$old-$new-g"


Regards,
Chella
4,442
Posted By chella
using sed
Hi,

Try this,

sed 's/.//1;s/[0-9]*:/\[press enter]
/g' inp.txt

Regards,
Chella
1,239
Posted By chella
Hi, Try this, autorep -j EDSPME% | grep...
Hi,

Try this,

autorep -j EDSPME% | grep ' OI' | grep -v '^ ' |awk '{print $4 " " $1}'| sort -r -t/ -k 3 -k 1 -k 2


Regards,
Chella
2,316
Posted By chella
But the awk works fine for me and I got your...
But the awk works fine for me and I got your expected output.

Try this,

awk -F, 'NR==FNR{a[$1]=$1;next}a[$1]' b.txt a.txt

From the above output you need to print only the first,fourth and...
2,316
Posted By chella
Then it can be done using awk, awk -F,...
Then it can be done using awk,

awk -F, 'FNR==NR {a[$1];next;}($1 in a) {print $1","$4","$5}' b.txt a.txt

Regards,
Chella
2,316
Posted By chella
Hi, Try this, grep -f b.txt a.txt | awk...
Hi,

Try this,

grep -f b.txt a.txt | awk -F, '{print $1","$4","$5}'

Regards,
Chella
4,366
Posted By chella
Hi, Since you have two labels(here...
Hi,

Since you have two labels(here document), both named as EOF it will create some problem. Try the below,

cat > File1.sh <<EOA

set feedback off
set serveroutput on

cat > File2.sh <<EOF...
14,200
Posted By chella
Hi, sed 's/^/ramesh/g;s/$/vellanki/g'...
Hi,

sed 's/^/ramesh/g;s/$/vellanki/g' faulty.txt


Regards,
Chella
14,200
Posted By chella
Hi, Assuming the input file as inp.txt ...
Hi,

Assuming the input file as

inp.txt

hello
shell
scripting


sed 's/^/UNIX /g' inp.txt

Is this what you expect? If not, please add your sample input and output for your problem
...
2,472
Posted By chella
Hi, Below command deletes the line with the...
Hi,

Below command deletes the line with the pattern,along with the next line.

sed '/%CLI-/{N;d;}' input.txt



I want these the following three lines


$CHECKSUM...
4,854
Posted By chella
Hi, Try this, sed 's/\^.[^ ]*//g'...
Hi,

Try this,

sed 's/\^.[^ ]*//g' input.txt

Regards,
Chella
4,260
Posted By chella
using grep and sed with a while loop
Try this,

#! /bin/ksh
cp inp.txt tmp_1.txt
while read line
do
sed "/$line/s/STAT [0-9][0-9]*/STAT 0/g" tmp_1.txt > tmp_2.txt
cp tmp_2.txt tmp_1.txt
done < exp.txt
cat...
4,260
Posted By chella
using grep and sed
You can also do this using grep and sed

grep -f exp.txt inp.txt | sed 's/STAT [0-9][0-9]*/STAT 0/g'

exp.txt is the exception file.

Regards,
Chella
2,388
Posted By chella
Try this, perl -pe 's/\\t/ /g'...
Try this,

perl -pe 's/\\t/ /g' filename.txt

Press a tab in the replace part

Regards,
Chella
3,265
Posted By chella
This will also help you, echo $TEMP | grep...
This will also help you,

echo $TEMP | grep ^[[:alpha:]][[:alpha:]]*$

Regards,
Chella
Showing results 1 to 25 of 75

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