Timeline for How to display certain lines from a text file in Linux?
Current License: CC BY-SA 4.0
17 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Sep 4, 2022 at 17:10 | history | suggested | Amir | CC BY-SA 4.0 | `-n`s were omitted. |
| Sep 4, 2022 at 13:29 | review | Suggested edits | |||
| S Sep 4, 2022 at 17:10 | |||||
| Oct 10, 2017 at 16:19 | comment | added | Dennis Williamson | @kev: I added some explanation to my answer. | |
| Oct 10, 2017 at 16:18 | history | edited | Dennis Williamson | CC BY-SA 3.0 | added some explanation |
| Oct 8, 2017 at 23:58 | comment | added | kev | Some more explanation would be nice. E.g. what is the "p", what is the "q" for at the end of the line numbers? | |
| Apr 13, 2017 at 12:14 | history | edited | CommunityBot | replaced http://serverfault.com/ with https://serverfault.com/ | |
| Aug 26, 2015 at 4:30 | comment | added | plhn | FYI, print from 10th line to the end : sed -n '10,$p' | |
| May 23, 2014 at 12:16 | comment | added | cuonglm | @DennisWilliamson: tail -n 10000 print the last 10000 lines. use tail -n +10000 to start print at 10000th line. | |
| Dec 19, 2012 at 5:58 | history | edited | Dennis Williamson | CC BY-SA 3.0 | edited body |
| Dec 19, 2012 at 5:57 | comment | added | Dennis Williamson | @beanland: Yes, it's a typo. I've fixed it. Thanks. | |
| Dec 18, 2012 at 21:51 | comment | added | Ian Hunter | Shouldn't the ` in your sed command be a '? I can't get it to work with the backtick but it works fine with the single quote. | |
| Apr 20, 2010 at 16:47 | comment | added | Dennis Williamson | The function in my previous comment can be called with a filename parameter: middle startline count filename or multiple filenames: middle startline count file1 file2 file3 or with redirection: middle startline count < filename or in a pipe: some_command | middle startline count` or cat file* | middle startline count | |
| Apr 20, 2010 at 11:11 | vote | accept | Boaz | ||
| Apr 19, 2010 at 15:55 | comment | added | Dennis Williamson | Here is a sed version of Charles' middle function: middle() { local s=$1 c=$2; shift 2; sed -n "$s,$(($s + $c -1))p; $(($s + $c))q" "$@"; }. It will handle multiple file arguments, filenames with spaces, etc. Multiple files are processed together as if they had been catted in the same way that sed normally does (so middle 1000 100 file1 file2 would span across the end of the first file to the beginning of the second one if the first one has fewer than 1100 lines). | |
| Apr 19, 2010 at 10:33 | history | edited | Dennis Williamson | CC BY-SA 2.5 | Additional information |
| Apr 19, 2010 at 9:21 | history | edited | Dennis Williamson | CC BY-SA 2.5 | Additional information |
| Apr 19, 2010 at 9:11 | history | answered | Dennis Williamson | CC BY-SA 2.5 |