<Cut Command>

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coaxfiber
    New Member
    • Mar 2007
    • 60

    <Cut Command>

    Hi,

    Just want to ask if cut command is capable of , please consider below:

    $cat read.txt
    1
    2
    3
    4
    --------------------------------
    Expected Output should get 1,2,3,4 one by one and pass it individually in a file.

    1 > a , 2 > b, 3 > c, 4 > d

    Thanks in Advance!!!
  • radoulov
    New Member
    • Jun 2007
    • 34

    #2
    Originally posted by coaxfiber
    Hi,

    Just want to ask if cut command is capable of , please consider below:

    $cat read.txt
    1
    2
    3
    4
    --------------------------------
    Expected Output should get 1,2,3,4 one by one and pass it individually in a file.

    1 > a , 2 > b, 3 > c, 4 > d
    No.
    With bash3 you can write something like this:
    Code:
    bash 3.2.13(1) $ paste -sd, <(paste -d">" <(printf "%s\n" $(<read.txt)) <(printf "$(printf "%s\n" {a..d})"))
    1>a,2>b,3>c,4>d

    Comment

    Working...