- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Awk, Gawk How to make a list of files
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
06-07-2005 06:34 AM
06-07-2005 06:34 AM
I'd like to use Gawk/Awk to create a list of files that already are in a specific folder.
Then I'd like to add thses "file names" to an existing txt file.
Anyone expert on this? Please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 06:45 AM
06-07-2005 06:45 AM
SolutionJust do:
# ls -1
This will create a 1 column list of files in whatever directory you are in. If you want to append that list to another file just do:
# ls -1 >> /dir/filename.txt
If this doesn't meet your requirements, please give more details about what exactly it is that you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:06 AM
06-07-2005 07:06 AM
Re: Awk, Gawk How to make a list of files
Thanks very much for your incredibly fast reply.
This is what I need to do with Awk / GAWK:
From this directory like:
c:\helpfiles
1-Make a list of all .htm files
2-add this list (write the names of these files) to a specific .hhp file (like helprelesase.hhp)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:13 AM
06-07-2005 07:13 AM
Re: Awk, Gawk How to make a list of files
A similar DOS command would be-
dir *.txt /b >>yourfile.hhp
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:14 AM
06-07-2005 07:14 AM
Re: Awk, Gawk How to make a list of files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:27 AM
06-07-2005 07:27 AM
Re: Awk, Gawk How to make a list of files
At the dos prompt in whatever directory you prefer:
dir /b *.htm >> c:\dir\yourfilename.hhp
You still don't need to get complicated with AWK to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:31 AM
06-07-2005 07:31 AM
Re: Awk, Gawk How to make a list of files
That was a random name.
What I am asking is that what would be my Awk program which would this procedure:
1-go to a specific directory,
2-copy the list of all existing .htm files into a .hhp file
I really appreciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:34 AM
06-07-2005 07:34 AM
Re: Awk, Gawk How to make a list of files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 07:35 AM
06-07-2005 07:35 AM
Re: Awk, Gawk How to make a list of files
becuz I am an idiot.
I didn't even know this is a unix forum.
I actually can use anything, as long as it does the job. Somebody suggested Awk.
Could you let me know what you think is best for this purpose?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 08:41 AM
06-07-2005 08:41 AM
Re: Awk, Gawk How to make a list of files
awks strength comes in its ability to work with other utilities/tools, which in a DOS environment is not so easy.
If you really wanted to have awk do the process then...
awk '{"cd /dir ; ls -1" | getline; print $0 >>"your.hhp"}'
But this is not the cleanest way to use awk...
HTH
-- Rod Hills