- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help please
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
04-08-2002 05:35 AM
04-08-2002 05:35 AM
Dir listing gives these file names
uv8980926993aa
uv8981027062aa
us9105010894aa
us9047009985aa
I require to pull out the 3 to 7th chars,
I.e.
uv8980926993aa
to become
89809
I have got this far :-
ll | awk '{print $9}' | sed "s/^uv//" | sed "s/^us//" | sed "s/aa//"
To give this:-
8980926993
8981027062
9105010894
9047009985
But what next ??
Thanks in advance
Paula
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:40 AM
04-08-2002 05:40 AM
Re: Script help please
What is about :
ll | awk '{print $9}' | cut -c3-7
Regards
Fr??d??ric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:41 AM
04-08-2002 05:41 AM
Re: Script help please
$ ls | cut -c 3-7
Regards,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:46 AM
04-08-2002 05:46 AM
Re: Script help please
ll | awk '{print $9}' | sed "s/uv\([0-9]\{5\}\)\(.*$\)/\1/"
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:47 AM
04-08-2002 05:47 AM
Re: Script help please
This to check.script with dir as parameter
file=$1
for f in $(ls -1 $file|sed -e 's:^.*/::g')
do
echo $f"|"$(echo $f|cut -c3-7)
done
This to do your option.
file=$1
for f in $(ls -1 $file|sed -e 's:^.*/::g')
do
echo $(echo $f|cut -c3-7)
done
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:47 AM
04-08-2002 05:47 AM
Re: Script help please
Try this
ls | awk '{print$9}' | cut -c 3-7
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 05:47 AM
04-08-2002 05:47 AM
Re: Script help please
cat input | cut 3-7
Greetings,
Ceesjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 06:04 AM
04-08-2002 06:04 AM
Re: Script help please
Enough already ---
I will check out and assign points.
Thanks
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 06:13 AM
04-08-2002 06:13 AM
Re: Script help please
Just for grins-and-giggles (although Harry's first solution using the 'substr' function of 'awk' my choice too):
# ls -l|tr -s " " "\t"|cut -f9|cut -c3-7
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 06:38 AM
04-08-2002 06:38 AM
Re: Script help please
More confusion...
If use ll, "grep -v ^total" needs to be added. I'd use ls instead of ll. You can explicitly say "ls -1" for one column output but ls will do that by default when it's output is piped to another command.
My vote for speed and simplicity is Steven Gillard's:
ls | cut -c 3-7
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 06:48 AM
04-08-2002 06:48 AM
Re: Script help please
Playing with the uv spool files I see! Keep in mind that sometimes files in the directory no longer will be in the uv index file and therefore will not be accessible as hold entries from the uv commandline. OTOH, this also means that you can safely wack them, as far as uv is concerned.
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 07:05 AM
04-08-2002 07:05 AM
Re: Script help please
Yes wonderful universe - I am writing an old file cleanup routine and intend to fire my results at:-
usm -k
As as you know Unix file name and Universe file name when using the usm are different.
Instead of just doing an rm on them I thought it safer to let the universe command deal with them.
Et Al.
All answer were worth 10 points - there is certainly more than one way to skin a cat.
:^)
Thanks
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 07:33 AM
04-08-2002 07:33 AM
Re: Script help please
Yes, been there, done that. Some caveats: you have to run this as root, but you can do it in cron. You also have to allow for the usm command to fail because the entry in the uv index is gone, so it won't remove the file. You can get around that like this:
usm -k
also be aware that not all of the usm/usa command options work, or work as advertised.
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2002 07:43 AM
04-08-2002 07:43 AM
Re: Script help please
us9047009985aa us9105010894aa uv8980926993aa uv8981027062aa
l1:/tmp 108 > perl -le 'for(grep s/^u[vs](\d{5}).*/$1/, ) { print }'
90470
91050
89809
89810
l1:/tmp 109 >