Skip to content

Instantly share code, notes, and snippets.

@snoek09
Last active January 7, 2016 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snoek09/0117a3ec64a243e7180e to your computer and use it in GitHub Desktop.
Save snoek09/0117a3ec64a243e7180e to your computer and use it in GitHub Desktop.
Bash script to use a file with line numbers to get the content from those lines from another file
#!/bin/bash
# Usage get_line_content_from_file.sh file_containing_linenumbers_only file
while IFS='' read -r line || [[ -n "$line" ]]; do
awk '{ if(NR==n) print $0 }' n=$line $2
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment