Timeline for Command to display first few and last few lines of a file
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 11, 2016 at 6:03 | comment | added | FCTW | @StéphaneChazelas TYVM! Long ago as I asked this, I've probably learned enough at my job to have figured this out, but your response is FANTASTIC! :-) | |
| Mar 10, 2016 at 15:08 | comment | added | Stéphane Chazelas | @FCTW, sudo sh -c '{ head; tail;} < /path/to/file' | |
| Jun 18, 2014 at 1:09 | comment | added | FCTW | How would you run this with sudo? | |
| Mar 24, 2014 at 19:56 | comment | added | Atcold | For multiple files we for f in *; do { head; tail;} < $f; done | |
| Mar 24, 2014 at 19:53 | review | Suggested edits | |||
| Mar 24, 2014 at 20:35 | |||||
| Feb 28, 2013 at 15:41 | comment | added | Stéphane Chazelas | @Marco, if there were problems with that, it would be with head, not the shell. POSIX requires head to leave the cursor in the file just past those 10 lines for regular files. A problem could arise for non-POSIX head implementations (very old versions of GNU head used to be non-conformant in that instance, but we're talking decades) or if the file is not seekable (like named pipe or socket, but then the other solution would have the same problem). | |
| Feb 28, 2013 at 15:39 | comment | added | Marco | @Gilles I missed the space: {head; tail;} < file works in zsh but fails in sh. { head; tail;} < file always works. Sorry for the noise. | |
| Feb 28, 2013 at 15:10 | comment | added | Gilles 'SO- stop being evil' | @Marco Huh? Only POSIX constructs are used here. What do you see going wrong? | |
| Feb 28, 2013 at 14:51 | comment | added | Marco | In contrast to rushs solution, this does not work in a POSIX shell. | |
| Feb 28, 2013 at 14:49 | history | edited | jofel | CC BY-SA 3.0 | correct spelling |
| Sep 21, 2012 at 12:02 | history | answered | Stéphane Chazelas | CC BY-SA 3.0 |