Search Results

Search: Posts Made By: jimmy_y
880
Posted By msabhi
sorry got your requirement wrong..try rdrtx1's...
sorry got your requirement wrong..try rdrtx1's solution...edited my code by removing it
1,098
Posted By elixir_sinari
perl -e 'if($ARGV[0] =~...
perl -e 'if($ARGV[0] =~ /\A[0-9]{10}\*0#[0-9]{9}#\z/){print "Valid string\n"}else{print "Invalid string\n"}' '1234567899*0#123456789#'
4,283
Posted By guruprasadpr
awk -F'\t' '$2 == "b"' 1 Guru
awk -F'\t' '$2 == "b"' 1

Guru
2,574
Posted By bartus11
Use code tags please. Try this:awk...
Use code tags please. Try this:awk '{a[$1]=a[$1]?a[$1]"|"$3:$3}END{for (i in a){print i,a[i]}}' file
1,464
Posted By kurumi
Ruby(1.9+) $ ruby -i -pne '$_="c\n" if...
Ruby(1.9+)

$ ruby -i -pne '$_="c\n" if $.==2; ARGF.close if ARGF.eof' 3 4
1,464
Posted By kurumi
the variable $. will not reset to 1 once the next...
the variable $. will not reset to 1 once the next file starts. It will continue counting.
1,464
Posted By bartus11
Try:for i in *; do perl -p -i -e "s/.*/c/ if...
Try:for i in *; do perl -p -i -e "s/.*/c/ if $.==2" $i; done
4,431
Posted By zaxxon
You can try if fgrep will be faster.
You can try if fgrep will be faster.
4,431
Posted By zaxxon
Try: grep -f 1.txt 2.txt
Try:

grep -f 1.txt 2.txt
3,510
Posted By zaxxon
awk -F";" 'length($2)>3 || length($3)>3'...
awk -F";" 'length($2)>3 || length($3)>3' infile
3,397
Posted By pravin27
Try this, awk -vRS="\n\n\n+"...
Try this,


awk -vRS="\n\n\n+" '{gsub("\n","")}1' infile
2,511
Posted By durden_tyler
$ $ $ cat f2 981 I field1 > field2.a: aa,...
$
$
$ cat f2
981 I field1 > field2.a: aa, ..si01To:<f:a@a.com>From: <f:a@a.com>;tag=DVNgfRZBZRMi96 <f:a@1:333>;ZZZZZ: 12345
$
$
$ perl -lne '/^\w+\s+\w+\s+(\w+)\s+\>\s+(\w+).*?To:(.*?)From:.*$/...
1,557
Posted By Franklin52
Another one: awk '$1=$1' RS= FS= OFS= file
Another one:
awk '$1=$1' RS= FS= OFS= file
1,557
Posted By bartus11
awk -vRS="" '{gsub("\n","")}1'...
awk -vRS="" '{gsub("\n","")}1' file
26,048
Posted By Franklin52
Works fine on my HP-UX system, try...
Works fine on my HP-UX system, try <Ctrl-v><Enter> instead of \n:
sed -n 'N;/in/s/^M.*//p'
26,048
Posted By pravin27
try this, awk '/in/ { print a } { a =...
try this,


awk '/in/ { print a } { a = $0}' inputfile
4,506
Posted By pludi
What about d-z, A-Z, 0-9, ...? What about values...
What about d-z, A-Z, 0-9, ...? What about values with more than 1 character?

One possible approach, if it's only a few possible characters (=< 10), would be to translate them to numbers, do a...
3,929
Posted By Scott
awk '$4 ~ /m/ {$2="00"$2}1' input_file
awk '$4 ~ /m/ {$2="00"$2}1' input_file
3,929
Posted By panyam
awk '$4~2{$2="00"$2}1' input_file
awk '$4~2{$2="00"$2}1' input_file
3,929
Posted By Scott
Change awk '$4==2{$2="00"$2}1' input_fileTo ...
Change

awk '$4==2{$2="00"$2}1' input_fileTo

awk '$4 ~ 2 {$2="00"$2}1' input_file
3,929
Posted By guruprasadpr
Hi Try this: $ awk '$2=$4==2?"00"$2:$2;'...
Hi
Try this:

$ awk '$2=$4==2?"00"$2:$2;' file
a b c 1 e e e e e
a 00b c 2 e e e e e

Guru.
3,929
Posted By panyam
awk '$4==2{$2="00"$2}1' input_file
awk '$4==2{$2="00"$2}1' input_file
5,491
Posted By durden_tyler
If you are looking for the equivalent of this - ...
If you are looking for the equivalent of this -


awk 'BEGIN{print strftime("%c",1273236600)}'


in Perl, then you may want to use the "POSIX" module, which includes the strftime function -

...
4,173
Posted By durden_tyler
I don't quite understand your question, or the...
I don't quite understand your question, or the meaning of "pchoh time", but is this what you are looking for ?


awk 'BEGIN{printf strftime("%c",1272814948)}'


tyler_durden
3,741
Posted By anbu23
Added gsub statement to scottn code awk -v...
Added gsub statement to scottn code

awk -v ORS=",," 'BEGIN {printf ORS} {gsub(" ","")} 1' file
Showing results 1 to 25 of 33

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