Search Results

Search: Posts Made By: Subbeh
1,020
Posted By Subbeh
Thanks! Works great
Thanks! Works great
938
Posted By Subbeh
Try this: awk '/---/{p++;next} p==2' file
Try this:
awk '/---/{p++;next} p==2' file
1,275
Posted By Subbeh
You can't put variables in the shebang. You could...
You can't put variables in the shebang. You could use the following depending on if you have the right bash path in your $PATHvariable:
#!/usr/bin/env bash
17,783
Posted By Subbeh
Hi wisecracker, I think I understand the OPs...
Hi wisecracker, I think I understand the OPs request quite clearly the way he described it. And although you make a valid point, I consider it as a data entry issue which I think is out of scope here.
17,783
Posted By Subbeh
This should fix it: sed -e :a -e...
This should fix it:

sed -e :a -e "s/\([^,]\)\"\([^,]\)/\1'\2/g;ta" file
1,888
Posted By Subbeh
Which OS and version of sed do you use? You...
Which OS and version of sed do you use?

You could try this:
find . -type f -iname *.ics -exec sed -i '/^DT\(START\|END\)/s/[0-9][0-9]$/00/;s/\r//' {} \;
1,111
Posted By Subbeh
Try this: tcpdump -i eth1 icmp[0] =8...
Try this:

tcpdump -i eth1 icmp[0] =8 >output.txt &
sleep 60; kill $!
3,225
Posted By Subbeh
1. The '<' character is used to redirect the...
1. The '<' character is used to redirect the output of sort to the diff utility. This is needed if you're not specifying a file directly to diff.

2. || is equal to OR, && is equal to AND. In this...
3,225
Posted By Subbeh
diff <(sort file1) <(sort file2) > /dev/null &&...
diff <(sort file1) <(sort file2) > /dev/null && echo files are the same || echo files are different
3,447
Posted By Subbeh
You can try this in awk: awk '/measInfo/ || s...
You can try this in awk:
awk '/measInfo/ || s {s=s?s"\n"$0:$0} /<\/measInfo>/{if (s ~ /string1/) print s; s=""}' file

It saves the xml block in a variable and prints it when the tag is closed...
1,134
Posted By Subbeh
Try this: awk -F\| 'NR==FNR {a[$1]=$0; next} $1...
Try this:
awk -F\| 'NR==FNR {a[$1]=$0; next} $1 in a {print a[$1]; next}1' file1 file2
2,387
Posted By Subbeh
Either use grep: if echo 'val1 val2 val3' |...
Either use grep:
if echo 'val1 val2 val3' | grep -q "$var1" ; then
echo $var1 found
fi
or case:
case "$var1" in
val1|val2|val3) echo $var1 found ;;
esac
1,294
Posted By Subbeh
Try: awk '($2+1)==$3' file
Try:
awk '($2+1)==$3' file
6,891
Posted By Subbeh
EOF needs to be on it's own, try this: EOF ...
EOF needs to be on it's own, try this:

EOF
ps -ef | grep pmon ; srvctl start database -d BATGPRD'
1,511
Posted By Subbeh
Replace tac with tail -r or sed '1!G;h;$!d', see...
Replace tac with tail -r or sed '1!G;h;$!d', see if that works
1,511
Posted By Subbeh
one way of doing it: tac file.xml | awk ' ...
one way of doing it:
tac file.xml | awk '
/vsDataEUtranCellFDD/ {id=1}
/vsDataEUtranFreqRelation/ {id=2}
/vsDataEUtranCellRelation/ {id=3}
/VsDataContainer id/ {sub(/ id=/,"_id_"id"=")}1' |...
4,049
Posted By Subbeh
Try using eval: eval p"$n"="$p" It's not...
Try using eval:
eval p"$n"="$p"

It's not a very good practise to set variables like this though. A much better way is to set arrays:
$ a[1]=test
$ echo ${a[1]}
test
2,500
Posted By Subbeh
What doesn't work? It works with the sample you...
What doesn't work? It works with the sample you provided:
sed 's/\([0-9]\) \([0-9]\)/\1:\2/g' file
1:0 0:1 1:1
0:1 1:1 0:0
1:1 0:0 1:1
1:0 0:1 0:1
0:1 0:0 1:0
1:1 1:1 1:1
0:0 0:0 0:0

...
1,864
Posted By Subbeh
sed '/<mytagone>/s/-/ /g' file
sed '/<mytagone>/s/-/ /g' file
2,736
Posted By Subbeh
awk '{print $1<$2?$1:$2}' file
awk '{print $1<$2?$1:$2}' file
1,773
Posted By Subbeh
Here is another approach: awk '{x=$3<$4?$3:$4;...
Here is another approach:
awk '{x=$3<$4?$3:$4; i=i?i:x ;if(x<=i){i=x; s=$0}} END{print s}' file
5,117
Posted By Subbeh
Try this: awk 'NR==FNR{a[$1]=$2; next}...
Try this:

awk 'NR==FNR{a[$1]=$2; next} /File_Nb/{$NF=a[$NF]}1' file2 file1
1,662
Posted By Subbeh
Try this: awk '{x=$1$2$3; a[x]=a[x]?a[x] FS $10...
Try this:
awk '{x=$1$2$3; a[x]=a[x]?a[x] FS $10 FS $11:$0} END {for(i in a) print a[i]}' file
22,578
Posted By Subbeh
I don't think he wants the code executed there;...
I don't think he wants the code executed there; it has to be run on the server which he makes an SSH connection to... Therefore, don't change the quotes.
2,250
Posted By Subbeh
You need to declare the variables using use vars...
You need to declare the variables using use vars for it to work:
use vars qw($opt_u $opt_p ...);
Showing results 1 to 25 of 83

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