Search Results

Search: Posts Made By: centurion_13
8,390
Posted By radoulov
And another one: awk '{ for (i = 1; ++i...
And another one:

awk '{
for (i = 1; ++i < NF;)
printf "%s", $i (i < NF - 1 ? OFS : ORS)
}' infile

On Solaris use gawk, nawk or /usr/xpg4/bin/awk.

With Perl:

perl -lane'
...
8,390
Posted By ctsgnb
awk '{NF--;$1=$1;sub(".*"$2,$2,$0)}1' infile ...
awk '{NF--;$1=$1;sub(".*"$2,$2,$0)}1' infile

use nawk if on solaris
8,912
Posted By mirni
@centurion_13: arabic() is a function defined in...
@centurion_13: arabic() is a function defined in Roman.pm module, to convert roman number to arabic (e.g.

$a = "XLVII";
$b = arabic($a); # b==47
That's what that Roman.pm module is made for.
...
1,628
Posted By birei
$ cat script.awk # Set field separator to pipe...
$ cat script.awk
# Set field separator to pipe '|'.
BEGIN { FS="|"; }
# If there are less of seven fields in a line, print it. The print statement of
# the line is the default action. It would...
1,628
Posted By rdcwayx
nawk -F \| 'NF<7' infile
nawk -F \| 'NF<7' infile
1,628
Posted By birei
Hi, Here a solution. Try it: $ awk...
Hi,

Here a solution. Try it:

$ awk --version | head -1
GNU Awk 3.1.6
$ cat infile
X|_|Y|_|Z|_|
A|_|B|_|
X|_|Z|_|H|_|
A|_|D|_|S|_|
R|_|F|_|D|_|
C|_|hbh|_|jnsdj|_|jhsd|_|
C|_| ...
1,723
Posted By dhiren1
$ awk -F "|" 'NR==FNR{a[$3]=$0;next} $1 in a &&...
$ awk -F "|" 'NR==FNR{a[$3]=$0;next} $1 in a && NF==5{ print a[$1],"_",$3}' OFS="|" file1.txt file2.txt
2|_|W|_||_|A
4|_|Z|_||_|C
Showing results 1 to 7 of 7

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