LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-11-2002, 02:01 AM   #1
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Rep: Reputation: 30
can i do this in shell?


a.txt a2.txt bdf.txt akfler.txt
=>
a.pdf a2.pdf bdf.pdf akfler.pdf

??
 
Old 09-11-2002, 02:12 AM   #2
adcripps
Member
 
Registered: Mar 2002
Location: South UK
Distribution: Mandrake 8.2
Posts: 103

Rep: Reputation: 15
What is it you're trying to do? Create a pdf?
 
Old 09-11-2002, 02:13 AM   #3
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
If you use a program to convert text files to pdf files then this can easily be done.

You could download txt2pdf from http://www.sanface.com
The program is shareware though. I don't know if there are any totally free versions out there.

Then you could do something like:

ls *.txt | xargs txt2pdf
 
Old 09-11-2002, 07:15 AM   #4
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Original Poster
Rep: Reputation: 30
sorry...
it was much vague..

i wanted to copy abc.a => abc.b
for all *.a files in a directory..

thank you
 
Old 09-11-2002, 08:04 AM   #5
sandy
Member
 
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230

Rep: Reputation: 30
Try chcase downloadable from http://www.blemished.net/chcase
 
Old 09-11-2002, 12:09 PM   #6
Matt00SS
LQ Newbie
 
Registered: Jul 2002
Posts: 10

Rep: Reputation: 0
If you're just trying to convert the extension, here you go:

ls *.txt |while read oldname;do
newname=`echo $oldname |sed 's/.txt/.pdf/'`
mv $oldname $newname
done


Enjoy,

Matt
 
Old 09-12-2002, 01:51 PM   #7
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Original Poster
Rep: Reputation: 30
k.. thx..

i was wondering if i can do that without writing scripts ..(just with options )

thank you anyway..
 
Old 09-12-2002, 05:05 PM   #8
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
I believe that the 'rename' command might do that for you. I remember being frustrated because I try to use it to do a simple renaming (as you would with mv), but it's actually more powerful than that.
 
Old 09-13-2002, 07:21 AM   #9
sandy
Member
 
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230

Rep: Reputation: 30
Quote:
Originally posted by Faecal
I believe that the 'rename' command might do that for you. I remember being frustrated because I try to use it to do a simple renaming (as you would with mv), but it's actually more powerful than that.
Thanks Faecal for the info. It was really a new information for me.
I was checking the command but in between I noticed an interseting thing

$ls
a.txt b.txt c.txt
$rename .txt .pdf *.txt
$ls
a.pdf b.pdf c.pdf
$rename *.pdf *.txt *.pdf
$ls
b.txt c.txt

Where is a.txt ???????????????
 
Old 09-13-2002, 07:56 AM   #10
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
I was able to reproduce that problem. Your second use of rename is incorrect -

$rename *.pdf *.txt *.pdf
$rename .pdf .txt *.pdf

Remember, it's only in the last argument that you're specifying a group of files. The first two are simply text to be searched for and replaced.

That odd behaviour where one file is lost only occurred for me when I used your incorrect command. I cannot explain the mechanism that led to the loss of the file, but it's not important, since the command with the extra asterisks shouldn't have worked properly anyway.
 
Old 09-13-2002, 08:35 AM   #11
sandy
Member
 
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230

Rep: Reputation: 30
Ok I know that I have used the "so -called" wrong syntax for the command rename. But Does anybody know where had the file a.pdf gone and why did it happen to that file only?
 
Old 09-14-2002, 01:08 AM   #12
speck
Member
 
Registered: Nov 2001
Location: US
Distribution: Slackware 14.2
Posts: 375

Rep: Reputation: 115Reputation: 115
Quote:
Originally posted by doublefailure
k.. thx..

i was wondering if i can do that without writing scripts ..(just with options )

thank you anyway..
If you want a gui, krename comes with pretty high praise.

Speck
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between normal shell and login shell Manish Linux - General 7 11-14-2012 08:30 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
shell interface vs shell scripting? I'm confused jcchenz Linux - Software 1 10-26-2005 03:32 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration