- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting 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
Forums
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
03-21-2001 08:41 AM
03-21-2001 08:41 AM
Scripting Question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 08:53 AM
03-21-2001 08:53 AM
Re: Scripting Question
You will have to use sed, or awk to grab the whitespaces and replace with "\ " (backslash/space) so that the shell will ignore the space.
Then you can rename them with the datestamp.
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 09:05 AM
03-21-2001 09:05 AM
Re: Scripting Question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 09:29 AM
03-21-2001 09:29 AM
Re: Scripting Question
ksh uses each of the characters in the value of the IFS variable to split into fields: the result from command substitution or parameter expansion of command words, and the result from command substitution or parameter expansion of words after in with for and select, and the characters that ksh reads with read.
ksh uses the first character of the value of IFS to separte arguments when ksh expands the * parameter, and when ksh expands ${varname[*]}.
Any sequence of characters belonging to the space class that are contained in IFS delimit a field, except for any character that appears in IFS more than once consecutively. Otherwise, each occurrence of an IFS character and adjacent space characters contained in IFS, delimit a field. If a space character is repeated consecutively in IFS, the character behaves like a non-space character so taht each occurrence delimits a field. If IFS is set to NULL, ksh does not perform field splitting.
Repeating a space character to cause each instance to act as a delimiter is available only on version of ksh newer than the 11/16/88 version.
To remove the normal meaning the ksh places on any special character, you must quote it. You can quote a single character by preceding it with a \. You can quote a string of characters by enclosing them in: single quotes, '...', to remove the special meaning of all characters except ', or ANSI C strings, $'...', to remove the special meaning of all characters except the ANSI C escape sequences, \b,\n,\t,\r,etc. ANSI C strings are only available on version newer then 11/16/88, or with double quotes, "...", to remove the special meaning of all characters except $,\,and '.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 11:26 AM
03-21-2001 11:26 AM
Re: Scripting Question
I'm not sure what you mean when you say 'ignore' the white space. Do you want filename 'CR filename.txt' to become 'CRfilename.txt.datestamp' or do you want it 'CR filename.txt.datestamp'?
Perhaps I can help in either scenario.
Peace,
Mo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 11:31 AM
03-21-2001 11:31 AM
Re: Scripting Question
I like these puzzles !!!!
ls -1 | awk '{ print "mv \"" $0 "\"" " " "\"" $0 ".2001-03-21\"" }' > doit.sh
Look at doit.sh and execute it !
May be someone can put in how to pass the date as a parameter
OK, I spell it, to be sure it is not misstyped:
Better you clip the line, than retype it.
Syntax is "ls -ONE", not "ELL"
Quoutesequence is:
single
double, EM, VEE, BLANK, backslash double, double
blank, $0, blank
double, backslash double, double
blank
double, blank, double
blank
double, backslash double, double
blank, $0, blank
double,
single
Have fun
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 11:35 AM
03-21-2001 11:35 AM
Re: Scripting Question
works not for NEW-LINES, but should do for blanks and tabs :-(
# ls -1
one one
two two
three three
# ls -1 | awk '{ print "mv \"" $0 "\"" " " "\"" $0 ".2001-03-21\"" }'
mv "one one" "one one.2001-03-21"
mv "two two" "two two.2001-03-21"
mv "three three" "three three.2001-03-21"
# ls -1 | awk '{ print "mv \"" $0 "\"" " " "\"" $0 ".2001-03-21\"" }' > doit.sh
# sh doit.sh
# ls -1
doit.sh
one one.2001-03-21
two two.2001-03-21
three three.2001-03-21
#
Sorry, if this was just 20% of it
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 11:46 AM
03-21-2001 11:46 AM
Re: Scripting Question
cat file1 > file2`date +%m%d%y`
Hope that helps.
Brian