Search Results

Search: Posts Made By: msabhi
4,125
Posted By msabhi
awk -F";" 'NR==FNR{x[$0]++;next;}...
awk -F";" 'NR==FNR{x[$0]++;next;} {if(x[$1]){print $0" HIT";} else print;}' file1 file2
5,850
Posted By msabhi
How about sed? var='select_id="x_0' ...
How about sed?


var='select_id="x_0' #you need not escape " when using single quote
sed "/$var/,/from/" x.txt
1,005
Posted By msabhi
perl -lne 'BEGIN{@id=split(/,/,"SL,SN, TB, pad...
perl -lne 'BEGIN{@id=split(/,/,"SL,SN, TB, pad up, pad down, time up to down, time down to pressure switch, time down to ready, time down to sweep");}
{for $id...
6,542
Posted By msabhi
-t "." this option stands for identifying...
-t "." this option stands for identifying delimiter and here its dot
-k3.1,3.4n "k start,stop" stands for field to start and stop at...first am sorting on years which happens to be 3rd column..so...
2,788
Posted By msabhi
You can change the text highlighted in red to...
You can change the text highlighted in red to your customized occurrence...
I hope i got your requirement right..
2,788
Posted By msabhi
For files 1>First check with the below command...
For files
1>First check with the below command if you are satisfied with the results

ls * | perl -lne '{$Tget=$_;s/\./ -- ttgductoog ggdté gollogtd./;print "$Tget"." <--TO--> "."$_";}'


2>If...
3,426
Posted By msabhi
if its only for the same date and same month then...
if its only for the same date and same month then try using this..


ls www* | sort -t"-" -k5 -r
1,706
Posted By msabhi
perl -alne '{if(/^\d/)...
perl -alne '{if(/^\d/) {$val=$F[0];$F[3]=~s/.*?-(\w+):(\d)/$1 $2/;print "$F[0] $F[1] $F[3]";} else{ if(/^100/){$F[2]=~s/.*?-(\w+):(\d)/$1 $2/;print "$val $F[0] $F[2]";next;}}}'


I thought this...
3,925
Posted By msabhi
I guess that limited to only bash... History...
I guess that limited to only bash...
History command inside bash script - Unix and Linux (http://unix.stackexchange.com/questions/5684/history-command-inside-bash-script)
2,763
Posted By msabhi
sh is used to execute the piped output from sed...
sh is used to execute the piped output from sed command...you can use your "shell" name there
3,093
Posted By msabhi
perl -alne '{if(/^\d/)...
perl -alne '{if(/^\d/) {$val=$F[0];$F[3]=~s/.*?-(\w+):(\d)/$1 $2/;print "$F[0] $F[1] $F[3]";} else{
if(/^ +/){$F[2]=~s/.*?-(\w+):(\d)/$1 $2/;print "$val $F[0] $F[2]";next;}}}' input_file


Hope...
3,166
Posted By msabhi
Hope this helps... awk -F "|"...
Hope this helps...

awk -F "|" '{array[$1]+=$2} END { for (i in array) {print i"|" array[i]"|"d}}' "d=$(date)" input_file
2,160
Posted By msabhi
sed 's@\(.*/\).*$@\1@' input_file
sed 's@\(.*/\).*$@\1@' input_file
12,559
Posted By msabhi
perl -lne '{if(/SNMP-ST/){$#A=-1;$f=1;} ...
perl -lne '{if(/SNMP-ST/){$#A=-1;$f=1;}
if(/IP/){$f=(/1\.1\.1\.1/)?1:0;}if(/SNMP-END/ && ($f)){print join("\n",@A,$_);next}($f)?push(@A,$_):next;}' input_file
1,777
Posted By msabhi
coooll...some minor correcti:)n...thanks DG
coooll...some minor correcti:)n...thanks DG
1,203
Posted By msabhi
perl -alne '{$h{$F[0]}.=" ".$F[1];}END{foreach...
perl -alne '{$h{$F[0]}.=" ".$F[1];}END{foreach $i (sort keys %h){print $i." ".$h{$i};}}' input_file
1,777
Posted By msabhi
awk -F "" '$31=="X" && $32=="T"' ...
awk -F "" '$31=="X" && $32=="T"' input_file
4,763
Posted By msabhi
perl -F'\|' -alne...
perl -F'\|' -alne '{$num=(length($F[10])<=3)?9:sprintf("9"x(length($F[10])-2));$F[9]=$F[10]+int(rand($num));$"="|";print "@F";}' input_file
1,777
Posted By msabhi
perl -F"" -alne '{($F[30]." ".$F[31])==("X...
perl -F"" -alne '{($F[30]." ".$F[31])==("X T")?print:next;}' input_file
4,763
Posted By msabhi
perl -F'\|' -alne...
perl -F'\|' -alne '{$num=sprintf("9"x(length($F[10])-2));$F[9]=$F[10]+int(rand($num));$"="|";print "@F";}' input_file
1,170
Posted By msabhi
perl -alne '{$h{"$F[1]...
perl -alne '{$h{"$F[1] $F[2]"}[0].=",$F[0]";$h{"$F[1] $F[2]"}[1].="$F[3];";}
END { foreach $item (sort keys %h ) {
$Tget="$h{$item}[0] $item $h{$item}[1]";$Tget=~s/(^,|;$)//g;print "$Tget"; }}'...
4,172
Posted By msabhi
Right elixir...new to PERL workarounds for...
Right elixir...new to PERL workarounds for files..somehow forgot its usage:wall:
Below code would be more efficient...:b:

perl -lne '{$Tget=$_;$_=~s/(.*?)(\d+)$/$2 $1/g;rename "$Tget", "$_"}' temp
4,172
Posted By msabhi
Ok. 1>First store all the necessary directory...
Ok.
1>First store all the necessary directory names into one file like "temp" and execute as usual to check if this is satisfying your conditions

perl -lne '{$Tget=$_;$_=~s/(.*?)(\d+)$/$2...
4,172
Posted By msabhi
No my script doesn't work for these directories...
No my script doesn't work for these directories you have mentioned since its different conditions all together....But you can use the logic in my script as a workaround ..let me know if any help...
4,172
Posted By msabhi
1>Verify is these are the conditions you require...
1>Verify is these are the conditions you require by just printing the mv command

ls *ext | perl -F"--" -alne '{if($#F==1){
if($F[1]=~/(\d+).ext/){ $p=$1;$F[0]=~s/^/$p /g;$F[1]=~s/$p//;print "mv...
Showing results 1 to 25 of 60

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