<quote who="david"> > Q1. why does sed lose the first line? > > da...@david:~/test$ cat blah > the quick > brown fox jumps > over > the lazy > dog > da...@david:~/test$ cat blah | while read line ; do sed s/t/T/ ; done
You want this instead: while read line; do echo $line | sed s/t/T/; done I always quote my sed expressions, and use allcaps for variables. Makes it easier to read when you're writing longer scripts. Plus you can avoid using cat if you want: while read LINE; do echo $LINE | sed 's/t/T/'; done < blah read shoves input into a variable, so you need to manipulate that variable once your input is going there. A simpler way of expressing your original script without the while loop: sed 's/t/T/' blah ;-) > Q2. what does the @ mean? > > da...@david:~$ date -d @1174306440 > Mon Mar 19 23:14:00 EST 2007 It's shorthand for saying "show me the human-readable date of this timestamp" (seconds from the epoch). You can get more info about how to use date by reading the info page (a gnu conspiracy to confuse the fuck out of everyone by making man pages useless in favour of some emacsed-up piece of crap help viewer). :-) - Jeff -- linux.conf.au 2010: Wellington, NZ http://www.penguinsvisiting.org.nz/ "Try Thunderbird, like Evolution but without all the features." - Pia Waugh -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
