Search Results

Search: Posts Made By: GoldenFire
22,870
Posted By Scrutinizer
awk '{i=$1;sub(i,x);A[i]=A[i]$0}...
awk '{i=$1;sub(i,x);A[i]=A[i]$0} FILENAME==ARGV[ARGC-1]{print i A[i]}' file*
5,510
Posted By vgersh99
from 'man awk': ARGC The...
from 'man awk':

ARGC The number of command line arguments (does not
include options to gawk, or the program source).

ARGV Array of command ...
7,295
Posted By radoulov
Now I see :) To the OP: you mean every two...
Now I see :)

To the OP: you mean every two characters, not every two digits ...

---------- Post updated at 05:17 PM ---------- Previous update was at 05:10 PM ----------

And if you want to...
7,295
Posted By vgersh99
sed 's/../&,/g' myFile
sed 's/../&,/g' myFile
8,016
Posted By Scrutinizer
awk 'NF<17{$(NF+1)=99999}1' infile
awk 'NF<17{$(NF+1)=99999}1' infile
8,016
Posted By Scrutinizer
awk 'NF<17{$0=$0 FS 99999}1' infile
awk 'NF<17{$0=$0 FS 99999}1' infile
8,016
Posted By pravin27
Verify your input file format. First post fields...
Verify your input file format. First post fields are separated by ","

so you can use

awk '{if($17==""){$17=99999};print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17}' inputfile
8,016
Posted By pravin27
or you can do like this, awk -F\, ...
or
you can do like this,

awk -F\, '$1>0{if($5==""){$5=99999};print $1,$2,$3,$4,$5}' inputfile
2,376
Posted By Chubler_XL
Awk should handle a different number of spaces...
Awk should handle a different number of spaces between each field (as long as you have at least 1 space).

You may need to run another script over you input files to get the columns seperated,...
2,376
Posted By rdcwayx
If there is no headings, it will be more simple: ...
If there is no headings, it will be more simple:

awk 'NR==FNR {A[$1 FS $2]=$9 OFS $10; next}
$1 FS $2 in A { print A[$1 FS $2], $0; } ' OFS="\t" FileB FileA
2,376
Posted By Chubler_XL
Here you go (With Fn headings in input...
Here you go

(With Fn headings in input files and output)
awk 'NR == FNR { A[$1"|"$2]=$9; B[$1"|"$2]=$10; OFS="\t" ; next}
FNR == 1 { printf...
2,807
Posted By Scrutinizer
awk -F'","' '$6""' infile ;) ---------- Post...
awk -F'","' '$6""' infile ;)

---------- Post updated at 08:36 ---------- Previous update was at 08:29 ----------

grep \\. infile
2,807
Posted By michaelrozar17
If i understood correctly- In the input file the...
If i understood correctly- In the input file the 6th column (with FS ,) of the shorter lines are- only double quotes " " whereas the longer lines has some values in 6th and the consecutive columns....
2,807
Posted By rdcwayx
awk -F, '$6!="\"\"" ' infile
awk -F, '$6!="\"\"" ' infile
2,129
Posted By Scott
Hi. Seems you've mixed up some sh and csh...
Hi.

Seems you've mixed up some sh and csh (if [[ `wc -l ${filen}` < 16 ]] is quite Bourne shell :) (except the < part)).


#!/bin/csh
set filen = `sh -c 'ls T 2> /dev/null'`
foreach fil...
2,687
Posted By DGPickett
Just send your file through: sed '...' <input...
Just send your file through: sed '...' <input >output

Enjoy!

Awk should be better at this, as it has field sense. I just lay out my commands so they are easier to review. White space is...
2,687
Posted By Scrutinizer
awk '(NR<3&&p=p (p?FS:x)$2)||$0=p FS$0'...
awk '(NR<3&&p=p (p?FS:x)$2)||$0=p FS$0' file
2,687
Posted By ctsgnb
awk '(NR<3){A[NR]=$2}{print((NR>2)?A[1]" "A[2]"...
awk '(NR<3){A[NR]=$2}{print((NR>2)?A[1]" "A[2]" "$0:$0)}' inputor
awk '(NR<3){A[NR]=$2}{print((NR>2)?A[1]FS A[2]FS$0:$0)}' inputorawk '{A[NR]=$2;print(NR>2)?A[1]FS A[2]FS$0:$0}'...
Showing results 1 to 18 of 18

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