We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Linux Shell
  3. Text Processing
  4. Head of a Text File #1
  5. Discussions

Head of a Text File #1

Problem
Submissions
Leaderboard
Discussions
Tutorial

Sort 47 Discussions, By:

recency

Please Login in order to post a comment

  • charlesartbr
    4 weeks ago+ 0 comments

    I don“t need to read the STDIN into a variable, you can just omit the filename in the head command like this:

    head -n 20
    

    Or, more simpler:

    head -20
    
    0|
    Permalink
  • cahitbarkinozer
    1 month ago+ 0 comments
    while read file; do
        echo $file >> file.txt
    done
    head -n 20 < file.txt
    
    0|
    Permalink
  • florin_tanasa
    3 months ago+ 0 comments
    #!/bin/bash
    while read FILE;
    do
    echo $FILE >> file.txt
    done
    head -n20 < file.txt
    
    1|
    Permalink
  • navneethraghu08
    5 months ago+ 0 comments

    head -n20

    0|
    Permalink
  • gangadharghru67
    8 months ago+ 0 comments

    You can find here HackerRank Linux Shell Solutions

    Head of a Text File #1 HackerRank Solution

    0|
    Permalink
Load more conversations

Need Help?


View tutorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy