416 links
  • Johndescs's mini-recording
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
  • thumbnail
    bash - How to read first and last line from cat output? - Unix & Linux Stack Exchange

    J'y aurais pas pensé : pour avoir que la première et la dernière ligne d'un pipe (ou autre), envoyer dans un subshell head et tail. Par exemple pour premier et dernier fichier d'un dossier :
    ll dossier | (head -n2 && tail -n1)
    (oui c'est head -n2 parce qu'il y a la ligne total débile là, on pourrait la virer en rajoutant une étape de pipe mais c'était juste pour visualiser alors je m'en fiche d'une ligne inutile)

    EDIT:
    On me souffle ça, c'est probablement mieux :
    ll dossier | sed -n '2p;$p'

    January 28, 2016 at 11:31:53 GMT+1 - permalink -
    QRCode
    - http://unix.stackexchange.com/questions/139089/how-to-read-first-and-last-line-from-cat-output
    unix
Links per page: 20 50 100
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation