about summary refs log tree commit diff stats
path: root/first-lines.sh
diff options
context:
space:
mode:
authorCase Duckworth2015-03-19 10:00:14 -0700
committerCase Duckworth2015-03-19 10:00:14 -0700
commite3994243e274b8b0e8111c5aac455331a2d5adc3 (patch)
tree71aa597d8a620405ad0999bd47b9563eafae79a1 /first-lines.sh
parentFix spacing in epigraph + wallpaper (diff)
downloadautocento-e3994243e274b8b0e8111c5aac455331a2d5adc3.tar.gz
autocento-e3994243e274b8b0e8111c5aac455331a2d5adc3.zip
Add index of first lines
Diffstat (limited to 'first-lines.sh')
-rw-r--r--first-lines.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/first-lines.sh b/first-lines.sh new file mode 100644 index 0000000..50b0e0c --- /dev/null +++ b/first-lines.sh
@@ -0,0 +1,17 @@
1#!/bin/bash
2
3outFile=src/first-lines.txt
4
5echo "" > $outFile
6
7for file in src/*.txt; do
8 echo -n "Getting first line of $file .. "
9 endOfYAML=$(sed -n '/^\.\.\.$/=' "$file")
10 firstLineNumber=$((endOfYAML + 2))
11
12 echo "$file: " >> $outFile
13 echo " $(head -n $firstLineNumber "$file" | tail -n 1)" >> $outFile
14
15 unset endOfYAML firstLineNumber
16 echo "Done."
17done