daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Jan 19th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. FILE=$1
  3. FROM=$2
  4. TO=$3
  5. if [ "$FILE" = ""]; then
  6.   echo Please provide a filename
  7.   exit 1
  8. fi
  9. if ! [ -f $FILE ]; then
  10.   echo File $FILE does not exists
  11.   exit 2
  12. fi
  13. if [ "$FROM" = "" ]; then
  14.   echo Please provide starting line
  15.   exit 3
  16. fi
  17. if [ "$TO" = "" ]; then
  18.   TO=$(cat $FILE | wc -l)
  19. fi
  20. awk "NR < $FROM { next } { print } NR == $TO { exit }" $FILE
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top