Created
June 9, 2020 15:12
-
-
Save iammapping/2d4cef97e5366b42aa847e6b796e3da3 to your computer and use it in GitHub Desktop.
cat head and tail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
BEGIN { | |
line = 0 | |
split_line_outed = 0; | |
arr[1] = ""; | |
} | |
{ | |
line = NR | |
arr[NR] = $0 | |
} | |
END { | |
for (i = 1; i < line + 1; i++) { | |
if (i > n && split_line_outed == 0 && line >= 2 * n + 1) { | |
split_line_outed = 1; | |
print "============"; | |
} | |
if (i <= n || i >= line - n + 1) { | |
print arr[i]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
find /your_dir -type f -exec cat {} ; | catht -v n=2000 | pbcopy