Search Results

Search: Posts Made By: sikku
9,660
Posted By Neo
You might find this link useful, but I've not...
You might find this link useful, but I've not tried it yet:
9,660
Posted By ctsgnb
basically it transform whatever1:whatever2 into...
basically it transform whatever1:whatever2 into whatever2:whatever1

It switches 2 columns that are separated with colon but in details ...

sed 's/RE/PATTERN/'|replace the first found regular...
9,660
Posted By ctsgnb
# echo "$string1 $string3" | tr ' ,|' '\n\n\n' |...
# echo "$string1 $string3" | tr ' ,|' '\n\n\n' | pr -2ts: | sed 's/^\([^:]*\):\([^:]*\)/\2:\1/' | xargs
123:abc:1 134:def:2 145:hij:3?
9,660
Posted By ctsgnb
Try this : string3=$(echo "$string1 $string2" |...
Try this :
string3=$(echo "$string1 $string2" | tr ' |' '\n\n' | pr -2 -t -s: | sed 's/^\([^:]*\):\([^:]*\)/\2:\1/' | xargs )
echo $string3
9,660
Posted By ctsgnb
@Sikku : $echo $s1 | tr ',' '\n' | cut -f1 -d:...
@Sikku :
$echo $s1 | tr ',' '\n' | cut -f1 -d: | xargs
123 124 126could be shorten (and save some pipe as well) with:
echo $s1 | sed 's/:[^,]*//g;s/,/ /g'---------- Post updated at 10:38 AM...
113,138
Posted By vino
See this. [/tmp]$ cat try.ksh #! /bin/ksh ...
See this.

[/tmp]$ cat try.ksh
#! /bin/ksh


if [[ -n "$1" ]] ; then
echo '$1'="[$1]"
else
echo '$1' is empty
fi
if [[ -n "$2" ]] ; then
echo '$2'="[$2]"
else
echo '$2'...
9,660
Posted By aigles
Merge the two tr statement into one : echo...
Merge the two tr statement into one :
echo "$string1 $string2" | tr ' |' '\n\n'

Jean-Pierre.
9,660
Posted By aigles
a pure shell (ksh) solution :#!/usr/bin/ksh ...
a pure shell (ksh) solution :#!/usr/bin/ksh

string1='abc|def|hij'
string2='12|13|14'
string3=''

oIFS="${IFS}"
IFS='|'

set -A str1 ${string1}
set -A str2 ${string2}

IFS="${oIFS}"
...
9,660
Posted By ctsgnb
paste -d: <(echo $string1 | sed 's/\|/ /g' |...
paste -d: <(echo $string1 | sed 's/\|/ /g' | xargs -n1) <(echo $string2 | sed 's/\|/ /g' | xargs -n1) | xargs

---------- Post updated at 12:07 PM ---------- Previous update was at 12:06 PM...
Showing results 1 to 9 of 9

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