Search Results

Search: Posts Made By: gc_sw
1,402
Posted By Don Cragun
Next time, please save us all a lot of time and...
Next time, please save us all a lot of time and aggravation by telling us what OS and shell you're using and showing us sample input and output that matches the data you want to process.

A...
6,686
Posted By MadeInGermany
And if you run the /var/tmp/gcsw/script.sh on the...
And if you run the /var/tmp/gcsw/script.sh on the command line?

Ensure it is executable,
and put a first line #!/bin/bash
to ensure it is the correct shell (your commands require bash or ksh or...
5,274
Posted By radoulov
You mean prepend :) printf '%s -> %s\n' "$(date...
You mean prepend :)
printf '%s -> %s\n' "$(date '+%Y-%m-%d %H:%M')" "$(/var/tmp/gcsw -ne | fgrep 'State:2' | wc)"
Forum: Solaris 09-05-2011
30,484
Posted By solaris_user
enter in terminal as root svcadm disable...
enter in terminal as root

svcadm disable svc:/network/sendmail-client:default
4,675
Posted By pravin27
Hi, Try this, awk -F"~"...
Hi,
Try this,


awk -F"~" 'NR==FNR{a[$1]++;b[$2]++;next} {split($0,c,"|");if(a[c[1]]){printf $0"~";getline tmp < "to_file"; split(tmp,d,"|");if(b[d[1]]){print tmp}}}' key_file from_file
2,276
Posted By ctsgnb
nawk '(/^To/||/^Subject/){sub(".*"$2,$2)}1'...
nawk '(/^To/||/^Subject/){sub(".*"$2,$2)}1' infile
sed 's/^To: //;s/^Subject: //;s/[<>]//g' infile
2,276
Posted By Scrutinizer
awk '{gsub(/[<>]/,x)}sub(/^(To|Subject): /,x)'...
awk '{gsub(/[<>]/,x)}sub(/^(To|Subject): /,x)' infile
2,276
Posted By anurag.singh
OR using sed: sed -n 's/^To: <\(.*\)>/\1/p'...
OR using sed:

sed -n 's/^To: <\(.*\)>/\1/p' email.txt
sed -n 's/^Subject: \(.*\)/\1/p' email.txt
5,345
Posted By bartus11
This will change the value from DEBUF to INFO for...
This will change the value from DEBUF to INFO for webservice "WEBSERVICENAME"perl -i -lp0e 's/(?<=name="WEBSERVICENAME")(.*?)DEBUG/$1INFO/s' Log4j.xml
908
Posted By anurag.singh
May be like below: Create an empty file when...
May be like below:
Create an empty file when script is schedule by 'at' and check for this file existance when 1st argument is 'start'

if [ $1 = "start" ]; then
if [ -f script_scheduled ];...
1,373
Posted By anurag.singh
awk 'NR==FNR{a=a?a"get . "$0";":"get ....
awk 'NR==FNR{a=a?a"get . "$0";":"get . "$0";";next;}{print "i ./shell "$0" "c a "l-"c}' c="'" Code ip.txt
2,670
Posted By michaelrozar17
Thanks radoulov. I have two question wrt the...
Thanks radoulov. I have two question wrt the field separator. If the field separator is ^A in the file, why do we have 2 backslashes, i thought one would be enough.If 2 backslashes it mean literally...
2,670
Posted By radoulov
You need one more backslash with the old command...
You need one more backslash with the old command substitution command:

export a=`awk -F'\\\^A' '{ print $1 }' file1.sh`

But, of course, you should use the new one $( ... ), if your shell...
2,472
Posted By pravin27
Try this, sed 's/,,/,DTP,/ ;s/,,/,DSS,/' ...
Try this,

sed 's/,,/,DTP,/ ;s/,,/,DSS,/' inputfile
2,472
Posted By Franklin52
Try this: awk -F, '$1{$4="DTP"; $6="DSS"}1'...
Try this:
awk -F, '$1{$4="DTP"; $6="DSS"}1' OFS=\, file
2,211
Posted By rdcwayx
That's the best.:b:
That's the best.:b:
2,211
Posted By Scrutinizer
awk 'NR==FNR{A[$3,$2]=$4;next}...
awk 'NR==FNR{A[$3,$2]=$4;next} NF>2{for(i=3;i<=NF;i+=3)$(i+2)=A[$i,$(i+1)];B[$1,$2]=$0;next} B[$1,$2]{print B[$1,$2]}' OFS='\t' ip-port.txt lookup.txt rollbackip.txt
2,211
Posted By m.d.ludwig
PLease be careful with [$1$2] and [$3$2]...
PLease be careful with [$1$2] and [$3$2] constructs, for data like
192.168.1.1 21
192.168.1.12 1will munge together. Awk "supports" multidimensional arrays -- it interpolates the value of...
2,393
Posted By anurag.singh
awk '/cell/ {n=split($3,a,"[-/]");...
awk '/cell/ {n=split($3,a,"[-/]"); for(i=2;i<=n;i++) if($(i+2) != "111111") print a[1],i-1}' file1.txt
If on Solarish, Just replace awk with nawk.
2,101
Posted By anurag.singh
awk...
awk 'NR==FNR{a[$1_$2]=$0;next;}{if(NF==1){if(substr($1,length($1)-3)=="Down") b=1; else b=0; } if(b==1 && a[$1_$2]) $0=a[$1_$2]; print; }' down.txt file.txt
2,393
Posted By anurag.singh
awk '/cell[0-9]*-1/...
awk '/cell[0-9]*-1/ {idx=index($3,"-");cell=substr($3,0,idx-1);n=split(substr($3,idx+1),a,"/"); for(i=1;i<=n;i++) if($(i+3) != "111111") print cell,a[i]}' file1.txt
3,158
Posted By anurag.singh
awk -F= '/description=..*/ || /instances=/...
awk -F= '/description=..*/ || /instances=/ {if(substr($0,1,11)=="description"){a=$2;getline;b=$2;print a" ["b"]";}}' rtprod2.scp
11,621
Posted By
command_prompt$ awk '{print $1}' excelFile >...
command_prompt$ awk '{print $1}' excelFile > firstCol
command_prompt$ paste firstCol textFile
2,599
Posted By Franklin52
This is what I get with the given file: $ cat...
This is what I get with the given file:
$ cat file
101221-18:45:17 192.168.1.1 1.0 PortNodeModel
=========================================================
Object Attribute Value...
2,599
Posted By fpmurphy
awk ' $2 ~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/...
awk ' $2 ~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {print "\n" $2 } NF == 3 && $1 ~ /^.*=.*$/ {print $0 }' file
Showing results 1 to 25 of 108

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