- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Challenging script
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
тАО09-10-2006 04:58 PM
тАО09-10-2006 04:58 PM
Re: Challenging script
# ./change
=========================================================
#!/usr/bin/sh
UP=$(echo $1 | awk '{print toupper($0)}')
Usr=$(awk '/^Alias/ {split($2,z,"/");u=z[2]} END {print u}' $2)
LUsr=$(awk '/^Alias/ {split($2,z,"/");l=tolower(z[2])} END {print l}' $2)
ex -s $2 <<-EOF
g/$Usr/ t /ErrorLog logs\/error_log/
/ErrorLog logs\/error_log/+1,$ s;/$Usr/;/\U$1/;g
/ErrorLog logs\/error_log/+1,$ s;/$LUsr/;/\L$1/;g
g/\/$UP\// m /ErrorLog logs\/error_log/
/ErrorLog logs\/error_log/ m $
wq
EOF
=========================================================
hope it helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2006 09:10 PM
тАО09-10-2006 09:10 PM
Re: Challenging script
Whenever I try to run that script it gives the following error.
./change: syntax error at line 3: `UP=$' unexpected
Not sure where the syntax error is?
I have copied directly as you wrote it.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 08:43 AM
тАО09-13-2006 08:43 AM
Re: Challenging script
# sh -x ./change
I'ave attached the script so that there are no invisible characters inserted into the shell script when you copy it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 03:48 AM
тАО09-26-2006 03:48 AM
Re: Challenging script
Using cat /etc/release for OS version
Solaris 8
$ sh -x ./change joe test2
+ awk + {print toupper($0)}
echo joe
UP=joe
+ awk /^Alias/ {split($2,z,"/");u=z[2]} END {print u} test2
Usr=BOB
+ awk /^Alias/ {split($2,z,"/");l=tolower(z[2])} END {print l} test2
LUsr=BOB
+ ex -s test2
g/BOB/ t /ErrorLog logs\/error_log/
/ErrorLog logs\/error_log/+1,$ s;/BOB/;/\Ujoe/;g
/ErrorLog logs\/error_log/+1,$ s;/BOB/;/\Ljoe/;g
g/\/joe\// m /ErrorLog logs\/error_log/
/ErrorLog logs\/error_log/ m $
wq
Substitute pattern match failed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 04:50 AM
тАО09-26-2006 04:50 AM
Re: Challenging script
uname -sr
SunOS 5.8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 04:57 AM
тАО09-26-2006 04:57 AM
Re: Challenging script
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 05:08 AM
тАО09-26-2006 05:08 AM
Re: Challenging script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 11:42 PM
тАО09-26-2006 11:42 PM
Re: Challenging script
Could you give an explanation of the following
g/$User/ t /ErrorLog logs\/error_log/
/ErrorLog logs\/error_log/+1,$ s;/$User/;/\U$1/;g
/ErrorLog logs\/error_log/+1,$ s;/$LcaseUser/;/\L$1/;g
/ErrorLog logs\/error_log/ m $
- « Previous
-
- 1
- 2
- Next »