Cat file a to *.xls files

J

Jim

Hi I'm trying to get a perl script to work without much luck.

What I'm trying to do is to:

cat filea.txt to all .xls files in a directory

your help would be appreciated

Thanks in advance
 
M

Mirco Wahab

Jim said:
Hi I'm trying to get a perl script to work without much luck.
What I'm trying to do is to:
cat filea.txt to all .xls files in a directory

Are you Jim the Italian living in French
Canada trying to write English?

(I didn't understand anything)

What's meant by 'cat' here? Can you explain?

Regards

M.
 
T

Tad McClellan

Jim said:
Hi I'm trying to get a perl script to work without much luck.

What I'm trying to do is to:

cat filea.txt to all .xls files in a directory

your help would be appreciated


No Perl needed, just use the shell!


# untested
for file in *.xls; do
cat filea.txt >>$file
done
 
T

tuser

No Perl needed, just use the shell!

# untested
for file in *.xls; do
cat filea.txt >>$file
done

in Perl (untested):
system("cat filea.txt >>$_") for glob "*.xls";
 
J

Jim

No Perl needed, just use the shell!

# untested
for file in *.xls; do
cat filea.txt >>$file
done

Thanks Tad, it worked nicely but, what I need is to have the contents
of filea.txt at the start of the .xls files. Is this possible to do?
 
J

Jürgen Exner

Jim said:
what I need is to have the contents
of filea.txt at the start of the .xls files.

Just for clarification: you want to prepend the content of filea.txt to
every *.xls file in a given directory.
Is this correct?

Your original question was anything but clear.

jue
 
T

Tad McClellan

It is bad netiquette to quote signatures.

Thanks Tad, it worked nicely but, what I need is to have the contents
of filea.txt at the start of the .xls files. Is this possible to do?


# untested
for file in *.xls; do
cat filea.txt $file >tmp
mv tmp $file
done
 
M

Michael Carman

No Perl needed, just use the shell!

# untested
for file in *.xls; do
cat filea.txt >>$file

I think Tad has been hanging around Abigail too much lately.

-mjc
 
T

Tad McClellan

Michael Carman said:
I think Tad has been hanging around Abigail too much lately.


But when _I_ type of bunch of line noise, it never ends up
being a Perl program. :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top