Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: jimmy_y
615
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
702
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#'
3,270
Posted By guruprasadpr
awk -F'\t' '$2 == "b"' 1 Guru
awk -F'\t' '$2 == "b"' 1

Guru
2,019
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,007
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,007
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,007
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
3,054
Posted By zaxxon
You can try if fgrep will be faster.
You can try if fgrep will be faster.
3,054
Posted By zaxxon
Try: grep -f 1.txt 2.txt
Try:

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


awk -vRS="\n\n\n+" '{gsub("\n","")}1' infile
2,128
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,235
Posted By Franklin52
Another one: awk '$1=$1' RS= FS= OFS= file
Another one:
awk '$1=$1' RS= FS= OFS= file
1,235
Posted By bartus11
awk -vRS="" '{gsub("\n","")}1'...
awk -vRS="" '{gsub("\n","")}1' file
21,857
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'
21,857
Posted By pravin27
try this, awk '/in/ { print a } { a =...
try this,


awk '/in/ { print a } { a = $0}' inputfile
3,882
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,350
Posted By Scott
awk '$4 ~ /m/ {$2="00"$2}1' input_file
awk '$4 ~ /m/ {$2="00"$2}1' input_file
3,350
Posted By panyam
awk '$4~2{$2="00"$2}1' input_file
awk '$4~2{$2="00"$2}1' input_file
3,350
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,350
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,350
Posted By panyam
awk '$4==2{$2="00"$2}1' input_file
awk '$4==2{$2="00"$2}1' input_file
5,039
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 -

...
3,451
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,275
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

 

Featured Tech Videos

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