Assuming the filenames end with .txt and have no spaces.
TAB=$(printf "\t"); for n in $(ls); do TITLE=$(basename -s .txt $
{n} ); cat ${n} | sed -E "s/$/${TAB}${TITLE}/g" > ${TITLE}_new.txt;
done;
Will.
On May 29, 4:18 am, LuKreme <[email protected]> wrote:
> On 28-May-2010, at 07:48, Tim Gray wrote:
>
> > On May 28, 2010 at 07:40 AM -0500, dp wrote:
> >> I have 57 files. Each contains a list of student names. In order to import
> >> into a database, I need to append the filename to the end of each line in
> >> each file. To use a simplified example, the Basketball_Boys.tab file
> >> contains
>
> > Sounds like the job for a perl or python script to me.
>
> Or just sed from the command line.
>
> --
> "A thousand years ago we thought the world was a bowl. Five hundred
> years ago we knew it was a globe. Today we know it is flat and round
> carried through space on the back of a turtle. Don't you wonder what
> shape it will turn out to be tomorrow?" [Lord Vetinari] --The Truth
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.