Search Results

Search: Posts Made By: shell_boy23
6,641
Posted By RudiC
This only looks at $NF's last char. This awk -F,...
This only looks at $NF's last char. This awk -F, '{if ($NF~/[0-9A-Za-z][0-9A-Za-z][0-9A-Za-z]/) print >"goodfile"; else print>"badfile}' samp.txtwill work on the example, but it does not take into...
13,087
Posted By balajesuri
perl -F, -lane 'print...
perl -F, -lane 'print join(",",@F[0..7]),",",join("|",@F[8..10]),",",$F[-1]' inputfile
13,087
Posted By itkamaraj
$ nawk -F\" -v OFS=\" '{gsub(/,/,"\|",$10)}1'...
$ nawk -F\" -v OFS=\" '{gsub(/,/,"\|",$10)}1' input.txt
"ABCD","I",23,0,9,,"23/12/2012","OK","Street|State| 91135",0
"ABCD","I",23,0,9,,"23/12/2012","OK","Street|State| 91135",0
13,087
Posted By Scrutinizer
Try: awk 'NR%2-1{gsub(/,/,"|")}1' RS=\" ORS=\"...
Try:
awk 'NR%2-1{gsub(/,/,"|")}1' RS=\" ORS=\" infile
"ABCD","I",23,0,9,,"23/12/2012","OK","Street|State| 91135",0
"ABCD","I",23,0,9,,"23/12/2012","OK","Street|State| 91135",0



--
Here is...
8,765
Posted By complex.invoke
[root@node2 ~]# sed -n '/C$/!p' infile ...
[root@node2 ~]# sed -n '/C$/!p' infile
def,adc,asdf,123,12A
[root@node2 ~]# sed -n '/C$/p' infile
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
8,765
Posted By 116@434
why don't you use regular expressions? Something...
why don't you use regular expressions? Something like
$NF ~ /.*C$/ { print > "splitC.csv" }
8,765
Posted By elixir_sinari
awk -F, '$NF ~ /C$/ {print > "splitC.csv";next}1'...
awk -F, '$NF ~ /C$/ {print > "splitC.csv";next}1' inputfile > splitother.csv
8,765
Posted By Klashxx
If the values where truly different: awk -F, -v...
If the values where truly different:
awk -F, -v vA="12C,13C" 'BEGIN{split(vA,a,",");for (i in a){b[a[i]]++}}{fic= $NF in b ? "splitC.csv" : "splitB.csv" ; print $0>>fic}' infile.csv
8,765
Posted By Ygor
Using the last character in each line...$ cat...
Using the last character in each line...$ cat Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A

$ awk '{print substr($0,length)}' Something.csv
C
C
A

$ awk...
Showing results 1 to 9 of 9

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