- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Working with files in a directory
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
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
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
тАО04-01-2002 06:56 AM
тАО04-01-2002 06:56 AM
Working with files in a directory
I have a directory with a lot of 'ascii' files. The names are not the same when I run the procedure that create these files. Each file has three columns and I have to do a script that get each file and if the name start with ABC put it??s contents into another file. So what I really want is similar to give a ls command and treat each file, testing if each file is in my scope. So, for example, if one of the files are ABC1234.txt, I would do "more $name_file >> example.txt" where $name_file the script should get from ls command from the files that is in my scope. The contents of every file started with ABC must be in example.txt.
Cheers,
Mauro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2002 07:02 AM
тАО04-01-2002 07:02 AM
Re: Working with files in a directory
for i in $(ls -1 ABC*)
do
cat $i >> example.txt
done
The above script will look for all files starting with ABC and do a cat on them with the contents of ALL of the files being put in example.txt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2002 07:03 AM
тАО04-01-2002 07:03 AM
Re: Working with files in a directory
You can do something like that:
for i in ABC*
do
cat $i >> exmaple.txt
done
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2002 07:05 AM
тАО04-01-2002 07:05 AM
Re: Working with files in a directory
if i understand you correctly (and i doubt about it, because it is to easy), all you need to do is:
cat ABC*.txt >>example.txt
Heiner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2002 07:51 AM
тАО04-01-2002 07:51 AM
Re: Working with files in a directory
It??s really easier than I had planned.
Cheers,
Mauro