- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk question
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
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
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-28-2007 04:22 AM
тАО06-28-2007 04:22 AM
find . -type f
returns this :
./SECQUERYuninstall
./2007.02_uninstall
./2007.03_install
./2007.03_uninstall
and I want to remove the initial ./ from the output and tried this :
find . -type f |awk -F"./" '{print $NF}'
but it gave me the wrong output :
/SECQUERYuninstall
02_uninstall
03_install
03_uninstall
How shall i get the following output :
SECQUERYuninstall
2007.02_uninstall
2007.03_install
2007.03_uninstall
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:32 AM
тАО06-28-2007 04:32 AM
Re: awk question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:37 AM
тАО06-28-2007 04:37 AM
Re: awk question
find . -type f output is :
./shellscripts/A/SECQUERYuninstall
./shellscripts/A/B/2007.02_uninstall
./shellscripts/C/2007.03_install
./shellscripts/D/2007.03_uninstall
and I want :
shellscripts/A/SECQUERYuninstall
shellscripts/A/B/2007.02_uninstall
shellscripts/C/2007.03_install
shellscripts/D/2007.03_uninstall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:41 AM
тАО06-28-2007 04:41 AM
Re: awk question
This approach only works in a special case; you said that you want to remove the INITIAL ./ from the string; consider the case of directories below the CWD.
That is why sub("^./","",$0) is the better approach; it removes ONLY the initial ./ becase the search is anchored.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:43 AM
тАО06-28-2007 04:43 AM
Re: awk question
# find . -type f | sed -e 's%^./%%'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:44 AM
тАО06-28-2007 04:44 AM
Re: awk question
awk: syntax error near line 1
awk: illegal statement near line 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:48 AM
тАО06-28-2007 04:48 AM
Re: awk question
Perhahps you forgot a " somewhere?
It would help to see the exact command line you used, not just the errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:51 AM
тАО06-28-2007 04:51 AM
Re: awk question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2007 04:57 AM
тАО06-28-2007 04:57 AM
Re: awk question
# find . -type f |awk -F"^./" '{print $NF}'
~hope it helps