Search Results

Search: Posts Made By: svks1985
2,116
Posted By RudiC
man bash: and
man bash:

and
2,116
Posted By RudiC
Try also ARR1=( $VAR1 ) ARR2=( $VAR2 ) for...
Try also
ARR1=( $VAR1 )
ARR2=( $VAR2 )
for IX in ${!ARR1[@]}; do echo "${ARR1[IX]}|${ARR2[IX]}"; done
20181225010|906676175
20190224010|907339851
20190224010|907453926
20190303010|907453962...
2,116
Posted By RavinderSingh13
Hello svks1985, Could you please try...
Hello svks1985,

Could you please try following.

awk 'FNR==NR{a[FNR]=$0;next} {print a[FNR]"|"$0}' <(echo "$var1") <(echo "$var2")


2nd solution: With paste.

paste -d'|' <(echo "$var1")...
1,802
Posted By Don Cragun
Given what was stated in post #3, you might also...
Given what was stated in post #3, you might also try something like:
awk '
BEGIN { FS = OFS = "|"
}
NR == 1 {
num = $1
printf("%s", $0)
next
}
{ printf("%s%s", $1 == num ? "\n" : " ", $0)...
1,802
Posted By Scrutinizer
Provided there are 14 fields and there is no line...
Provided there are 14 fields and there is no line break in the last field, try:
awk -F\| '{while(NF<14 && (getline n)>0) $0=$0 OFS n}1' file
1,802
Posted By itkamaraj
$ awk -F\| '$1~/^[0-9]/{printf("\n%s...
$ awk -F\| '$1~/^[0-9]/{printf("\n%s ",$0);next}{printf("%s",$0)}END{print "\n"}' input.txt

113321|107|E|1|828|20|4032832|EL POETA|VILLALOBOS MIJARES PABLO NEPTALI RICARDO...
1,802
Posted By RavinderSingh13
Hello svks1985, For any digits(which are...
Hello svks1985,

For any digits(which are present in starting of any line) above code should work. Following explanation could help you in same but it is only for explanation you have to run it in...
1,802
Posted By RavinderSingh13
Hello svks1985, Could you please try...
Hello svks1985,

Could you please try following and let me know if this helps you.

awk '{printf("%s%s",($0 ~ /^[[:digit:]]/ && NR>1)?RS:((NR>1)?FS:""),$0)} END{print X}' Input_file

Output...
3,556
Posted By shamrock
Yet another way of doing the same thing with...
Yet another way of doing the same thing with awk..
awk -F\| '{OFS="|";gsub(",",RS$1FS,$2);print}' file
3,556
Posted By durden_tyler
$ $ cat test.dat Field1|Field2 ...
$
$ cat test.dat
Field1|Field2
123|345,567,789
234|563,560
345|975,098,985,397,984
456|736
$
$
$ awk -F"|" '{n=split($2,a,","); for(i=1;i<=n;++i){print $1"|"a[i]}}' test.dat
Field1|Field2...
3,556
Posted By junior-helper
Try awk -F'[\|,]' 'BEGIN {OFS="|"} NR==1...
Try
awk -F'[\|,]' 'BEGIN {OFS="|"} NR==1 {print;next} {for (i=2;i<=NF;i++) print $1, $i}' file
1,400
Posted By RudiC
Try this, test being the input file: sort -t\:...
Try this, test being the input file:
sort -t\: test|paste -sd' \n' -
resulting in
1234:45675:123456 16 bbc1 9813806....... 1234:45675:123456 18 nnb1 98123456.......
2303:13593:137135 16 abc1...
Showing results 1 to 12 of 12

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