Search Results

Search: Posts Made By: Tuxidow
4,039
Posted By RudiC
None of the solutions so far covers your other...
None of the solutions so far covers your other condition "if the 3rd column is empty it shouldn't delete that line". Adapt your own solution like

awk -F "^" '$3=="|" || $4!="|"' fileNote that...
4,039
Posted By RavinderSingh13
Hello Tuxidow, Could you please try...
Hello Tuxidow,

Could you please try following.


awk -F'\\|\\^' '$3==""{next} $4' Input_file


NOTE: After seeing Rudi sir's comment edited this solution now.

Thanks,
R. Singh
2,355
Posted By durden_tyler
One way to do it would be to keep appending and...
One way to do it would be to keep appending and "building" two different strings - one for all users and the other for all user role assignments inside the while loop.
Once you're done with the...
1,648
Posted By rdrtx1
awk '{if (!b[$1,$2]++) {if (a) print a; a=$0}...
awk '{if (!b[$1,$2]++) {if (a) print a; a=$0} else {a=a "," $NF}} END { print a } ' infile
1,648
Posted By MadeInGermany
A bit altered coding: awk '{key=$1FS$2;...
A bit altered coding:
awk '{key=$1FS$2; a[key]=((key in a) ? a[key]","$3 : $3)} END {for (key in a) {print key, a[key]}}' testfile
1,648
Posted By pravin27
try below awk '{if (a[$1FS$2FS]) {a[$1FS$2FS]...
try below
awk '{if (a[$1FS$2FS]) {a[$1FS$2FS] =a[$1FS$2FS]","$3} else {a[$1FS$2FS]=$3}} END {for (key in a) { print key a[key]}}' testfile
1,947
Posted By Corona688
This is not Perl. This is 99% shell code in a...
This is not Perl. This is 99% shell code in a transparently thin wrapping of perl. You could dispense with the Perl and hardly see a difference:

string="test.binary.value"...
1,947
Posted By Aia
Instead of my $returnCode = system ( "ssh $host...
Instead of
my $returnCode = system ( "ssh $host 'cp -p /tmp/testfile /tmp/testfile.bkup; sed -i 's/\$string.*/\$toggle/g' /tmp/testfile'" );
try
my $returnCode = qx( ssh $host "cp -p /tmp/testfile...
1,196
Posted By sea
Heya You are reading fname, and compare name...
Heya

You are reading fname, and compare name later.
Also highly recomend, use quotes around variables when comparing (if, case, ...)
Otherwise an empty variable results in a failing script,...
1,776
Posted By elixir_sinari
sed -n '/10\.28\.[78]6\.15/{ ...
sed -n '/10\.28\.[78]6\.15/{
s/\("[^"]*\)\{3\}"/ /
s/,.*//
p
}' file
1,776
Posted By pamu
like this.....? awk -F '[" ]' '{for...
like this.....?


awk -F '[" ]' '{for (i=1;i<=NF;i++){ if ((! s) && $i ~ /[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9]/) {print $1,$2,$i}}}' file
1,776
Posted By Klashxx
Or: # awk...
Or:
# awk '/10.28.76.15|10.28.86.15/{gsub(/\"|,/,"");print $1,$2,$(NF-1)}' infile
1,776
Posted By zaxxon
Must it be sed? $ awk -F "[ ,\"]"...
Must it be sed?


$ awk -F "[ ,\"]" '/(10.28.76.15|10.28.86.15)/ {print $1,$2,$(NF-3)}' infile
10.28.76.15 SSLC=Z42 71.19.175.130
10.28.76.15 SSLC=Z42 71.19.175.130
10.28.76.15 SSLC=Z42...
2,040
Posted By guruprasadpr
Hi $ sed 's/\([^ ]*\).*\(HPSAC=[^\&]*\).*/\1...
Hi

$ sed 's/\([^ ]*\).*\(HPSAC=[^\&]*\).*/\1 \2/' file
66.150.161.195 HPSAC=Z05
66.150.161.196 HPSAC=A05

Guru.
Forum: Solaris 05-06-2011
6,768
Posted By bartus11
The error is pretty descriptive. You have 2...
The error is pretty descriptive. You have 2 columns too many in those additional /proc mount entries. Try: #device device mount FS fsck mount mount
#to mount ...
1,433
Posted By citaylor
tar -C...
tar -C /library/utility/apache-tomcat/tbase-6001/repositories -cvf - . | ( mkdir -p /library/utility/apache-tomcat/tbase2008-6001/repositories ; cd...
17,520
Posted By ctsgnb
In some other country whose timezone differs from...
In some other country whose timezone differs from GMT, you should take into account the offset a reliable calculation could be something like


# -- calculate time using GMT --
Uday=`TZ=GMT date...
781
Posted By cabrao
unzip -l AMT1-NA-20101007-1.zip | awk...
unzip -l AMT1-NA-20101007-1.zip | awk '/[0-9]:[0-9]/ {print $4,$1}'
3,551
Posted By bartus11
You can try this: nohup tail -f file | awk...
You can try this: nohup tail -f file | awk '/logout/{system("echo message | write root")}' &It will run in the background until someone kills it or reboots the server (it will wun after you log out...
3,551
Posted By radoulov
Something like this (untested, run with nohup in...
Something like this (untested, run with nohup in background):

tail -f <your_file> |
while IFS= read -r; do
case $REPLY in
( *your pattern* ) run_your_commands ;;
esac
done
2,754
Posted By aigles
#!/usr/bin/awk -f BEGIN { FS = "[\" :]+"; ...
#!/usr/bin/awk -f
BEGIN {
FS = "[\" :]+";
}

{
sub(FS "$", "");
DateTime = $1 ":" $2 ":" $3 ":" $4;
Action = $5;
ActionLower = tolower($5);

if (ActionLower ==...
Showing results 1 to 21 of 21

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