[#!/Bash Script] Cara menyusun baris jadi kolom

Discussion in 'Masalah Teknik dan Keamanan' started by riak, 10 Mar 2015.

Thread Status:
Not open for further replies.
  1. riak

    riak Beginner 2.0

    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    Permisi, numpang nanya para master sekalian. Agak bingung sebenernya ngasi judulnya hehehe..

    Milsalnya saya punya file txt (angka.txt) yang isinya sbb:

    # cat angka.txt
    1.2.3.4.5
    16.7.8.9.0
    11.12.13.14
    15.16.17.18


    Nah, pada saat di cat isi file tampil berurutan/berbaris ke bawah seperti diatas, nah skrng susunannya ingin saya rubah secara otomatis jadi seperti dibawah ini pada saat di cat tanpa merubah isi file/bentuk awal dari file angka.txt tersebut:

    # cat angka.txt
    1.2.3.4.5 16.7.8.9.0 11.12.13.14 15.16.17.18


    Kira-kira caranya gimana ya? Thanks :D
     
  2. indra

    indra Apprentice 2.0

    Messages:
    567
    Likes Received:
    29
    Trophy Points:
    28
    Code:
    cat angka | tr '\n' ''
    
    PS: untested
     
    riak likes this.
  3. mustafaramadhan

    mustafaramadhan Hosting Guru

    Messages:
    3,237
    Likes Received:
    857
    Trophy Points:
    113
    Coba:
    Code:
    cat /tmp/angka.txt|tr '\n' ' '
     
    riak likes this.
  4. riak

    riak Beginner 2.0

    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    Thanks berat Tuan, worked :D
     
  5. riak

    riak Beginner 2.0

    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    Thanks berat juga buat Tuan mustafa, worked :D
     
Thread Status:
Not open for further replies.

Share This Page

Loading...