   SHELL SCRIPTING: accessing individual lines
  Hi all,I'm writing a bash script and I have a file that is just a long list of file names, with one file on each line.  I would like to select an individual line and return the filename on that line (and then proceed to delete the line from the file).  I'm still learning about shell programming and I'm not sure if there is a simple command out there to do this or if its going to require some involved programming.  If anyone knows of a simple, elegant way to do this, I'd really appreciate the help!Thanks a lot!   
  I am an awful, awful, awful scripter so please don't use this, but it works:grep -n '.\?' $FILENAME | egrep '^'"$LINENO" | sed -e '{s%^[0-9]\+:%%}'EDIT: there is also probably a very easy simple way to do it.   ;  It'd probably be a lot easier to just use a programming language; this took me about a minute:#!/usr/bin/pythonimport sysnames = open(sys.argv[1]).readlines()line = int(sys.argv[2])print names[line-1]del names[line-1]open(sys.argv[1], "w").write("".join(names))edit:Whoops. Darned python and its not-stripping-newline-off behavior :/   ;  I hope I'll be able to post this once and not multiple times, because the server is having serious issues.Assuming you simply need to remove the name N from the file "names":#!/bin/shstr=""i=0for name in `cat names`; do  [ $i -ne $1 ] && str="${str}${name}\n"  i=`expr $i + 1`doneecho -ne "$str" > namesUsage, assuming that the file is called "foo.sh", made executable with chmod +x, and located in the current directory with the file "names":./foo.sh IDwhere "ID" is an integer corresponding to the line to remove (0 being the first line).Obviously this is barebone (there is no error checking of any kind) and shouldn't be used in production. If you want to do something with the name corresponding to the ID passed to the script, you'll have to use a if-then-else-fi conditional.Hope this helps.