Search Results

Search: Posts Made By: vivek d r
2,133
Posted By CarloM
Why do you have quotes on the asterisk? Try ...
Why do you have quotes on the asterisk?

Try
sed 's/, *;/;/g'
1,873
Posted By Corona688
Humor me... We don't know that it's not 1 or...
Humor me... We don't know that it's not 1 or 1\r or what have you. In fact, do it like this:printf "[%s]\n" "${lineno}" | hexdump -C

Your error messages in particular make me very very...
13,001
Posted By Jotne
awk '!(/7800/ && /REJECT/ || /3306/ && /DROP/ ||...
awk '!(/7800/ && /REJECT/ || /3306/ && /DROP/ || /5070/ && /REJECT|DROP/)' fileName >newfile
rm fileName
mv newfile fileName
13,001
Posted By MadeInGermany
sed -i '/7800.*REJECT/d; /3306.*DROP/d;...
sed -i '/7800.*REJECT/d; /3306.*DROP/d; /5070.*REJECT/d; /5070.*DROP/d;' fileName
16,402
Posted By Jotne
With awk awk 'NR==4 {$0="me there $chco"} 1'...
With awk
awk 'NR==4 {$0="me there $chco"} 1' file
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
me there $chco
et cetc etc
etcetera
16,402
Posted By hanson44
$ sed '4 c \"me there \$ech\"' output blah...
$ sed '4 c \"me there \$ech\"' output
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
"me there $ech"
et cetc etc
etcetera

$ sed '4 s/.*/\"me there...
3,161
Posted By Corona688
It is stored right, but when you echo an unquoted...
It is stored right, but when you echo an unquoted string, substitution happens.

It takes the *'s to mean 'expand filenames' and flattens all white space when you echo an unquoted string. Try...
1,545
Posted By balajesuri
sed -n '/CCM HA Status/,/----------/p' file >...
sed -n '/CCM HA Status/,/----------/p' file > tablextract.sql
1,545
Posted By zaxxon
awk '/CCM HA Status/ {f=1; next} /^-----/ {f=x}...
awk '/CCM HA Status/ {f=1; next} /^-----/ {f=x} f' infile


If the other pattern is needed, just alter the pattern or add it with a "or" ||, just as you need it.
1,545
Posted By anbu23
$ sed -n "/CCM HA Status:/,/---------/{/CCM HA...
$ sed -n "/CCM HA Status:/,/---------/{/CCM HA Status:/d;/---------/d;p;}" file
Server:XXX.XX.XX.XX not enabled
Server Role:ACTIVE
Server State:AVAILABLE
Network State:GY_PY

Or

$ awk ' /CCM...
1,790
Posted By drl
Hi. The msort utility can do tasks such as...
Hi.

The msort utility can do tasks such as sort by blocks, and with custom collating sequences:
#!/usr/bin/env bash

# @(#) s1 Demonstrate block sort with custom ordering.
# See:...
11,826
Posted By Yoda
date -d"Tue Mar 5 23:44:28 EST 2013" +"%m-%d-%Y...
date -d"Tue Mar 5 23:44:28 EST 2013" +"%m-%d-%Y %I:%M %p"
1,735
Posted By Jotne
This can easy be down with awk awk '!/LOW/'...
This can easy be down with awk
awk '!/LOW/' RS="\n *\n" ORS="\n\n" infile

Since your input file does have one space I did add * space,star as RS...
1,735
Posted By pamu
Try awk -F "="...
Try

awk -F "=" '$1=="NAME"{for(i=1;i<=X;i++){if(!t){print A[i]}};X=t=0}
{A[++X]=$0}
$2=="LOW"{t++}
END{for(i=1;i<=X;i++){if(!t){print A[i]}}}' file
8,306
Posted By Scrutinizer
epoch 13 uses milliseconds instead of seconds,...
epoch 13 uses milliseconds instead of seconds, since you are not using the extra precision with your date command, why not try simply adding 3 zeroes at the end?
date +%s000 -d "Mon Feb 11 02:26:04"
1,540
Posted By Scrutinizer
Like so? sed 's/\(.\)\(.\)/\2 \1 /g'
Like so?
sed 's/\(.\)\(.\)/\2 \1 /g'
12,326
Posted By Scott
So the problem is the 0a? That's a ^J (newline). ...
So the problem is the 0a? That's a ^J (newline).

echo $cutString | xxd -c 256 -ps | sed "s/..$//"
12,326
Posted By Scott
Yes, I guess so. I didn't see an xxd option to...
Yes, I guess so. I didn't see an xxd option to remove it.

It would not be there if you used printf instead of echo, actually.


printf $cutString | xxd -c 256 -ps
3,448
Posted By Yoda
awk -F'[=|"|<|>|,]' '{for(i=1;i<=NF;i++){ ...
awk -F'[=|"|<|>|,]' '{for(i=1;i<=NF;i++){
if($i=="Alert id") {
if(id!="") print id,nm,fx,dt;
id=($i=="Alert id")?$(i+2):id; }
nm=($i==" name")?$(i+2):nm;
fx=($i==" fixed")?$(i+2):fx;
...
3,448
Posted By Yoda
To change the output format: awk...
To change the output format:
awk -F'[=|"|<|>|,]' '{for(i=1;i<=NF;i++){
if($i=="Alert id") {
if(id!="") printf "ID=%d\nNAME=%s\nFIXED=%s\nDATE=%s\n", id,nm,fx,dt;
id=($i=="Alert...
3,448
Posted By Yoda
You are right. Depending upon other tag value...
You are right. Depending upon other tag value positions I have adjusted it. I hope you understood.
6,877
Posted By DGPickett
Shouldn't delete reference input and output not...
Shouldn't delete reference input and output not output twice?
1,340
Posted By Scott
$ var="1 3 5 7 9 11 13 15 17 19 21 23 ..." $...
$ var="1 3 5 7 9 11 13 15 17 19 21 23 ..."
$ set -- $var
$ shift
$ var=$@
$ echo $var
3 5 7 9 11 13 15 17 19 21 23 ...


You could maybe encapsulate it into a function for easier use.
2,915
Posted By ctsgnb
Nope, the sed statement i proposed (post #6 )...
Nope, the sed statement i proposed (post #6 ) will only replace the third coma of every line.

That's why it supposes that the format of your file doesn't vary.

Just another one in another...
22,481
Posted By elixir_sinari
Try this... a bit ugly though... awk...
Try this... a bit ugly though...


awk -F"(" 'BEGIN{OFS=FS} {
split($2,t,", ");
for(i in t)
{
if(t[i] ~ /lastModified/)
posit=i
}
for(i=3;i<=NF;i+=1)
{
n=split($i,s,",")
...
Showing results 1 to 25 of 125

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