- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How can I use the content of a file for a com...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2000 02:59 AM
09-21-2000 02:59 AM
Something like rm
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2000 03:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2000 03:04 AM
09-21-2000 03:04 AM
Re: How can I use the content of a file for a command?
cat file.txt | xargs rm
it should work fine!
Federico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2000 03:06 AM
09-21-2000 03:06 AM
Re: How can I use the content of a file for a command?
for files in `cat verw.txt`
do
rm $files
done
I hope that this answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2000 03:13 AM
09-21-2000 03:13 AM
Re: How can I use the content of a file for a command?
cat verw.txt | xarg rm
becaus there is a limit to the number of parameters that rm can handle when used in rm `cat verw.txt`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2000 03:25 AM
09-21-2000 03:25 AM
Re: How can I use the content of a file for a command?
The more 'politically correct' construct is $(command) but both work equally well.
Thus rm $(verw.txt) will also work but beware that the shell has a limit of how many arguments can be passed to a command so if verw.txt has a lot (several thousand) of records this could fail.
This is where xargs scores as it only supplies the arguments a record at a time to the command you supply.
e.g. cat verw.txt | xargs rm
This does result in the 'rm' command being invoked for every record in verw.txt so it is not so efficient as the single rm call in the first example.