- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed batch editor - Change select lowercase areas f...
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
тАО02-23-2001 04:18 AM
тАО02-23-2001 04:18 AM
change each occurence of $IING$xx to $IING_XX
where xx can be any 2 letters. ie I want to tell sed to change to uppercase the 2 letters following the RE pattern of '$IING$'
Does anyone have any ideas. I think it may involve the use of the holding space???
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2001 02:11 AM
тАО02-26-2001 02:11 AM
Re: sed batch editor - Change select lowercase areas from lower to upper case
I don't use "sed" to do this.
Maybe this will help you;
VAR_CAP=`echo ${VAR_xx} | tr '[a-z]' '[a-z]'`
This will translate all characters (form a to z) into capitals.
Good luck,
Arthur Pols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2001 03:17 AM
тАО02-26-2001 03:17 AM
Re: sed batch editor - Change select lowercase areas from lower to upper case
I do not see a straightforward solution using sed, but if you have perl 5 on your system, followinf script does the job:
========
#!/opt/perl5/bin/perl -w
open(INPUT, "/tmp/testfile");
while ( ) {
if ( /^(.*)\$IING\$(..)(.*)$/ ) {
$upper = uc($2);
print "$1", '$IING$', "$upper", "$3", "\n";
} else {
print;
}
}
=======
Hope this helps,
Rik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2001 06:32 AM
тАО02-26-2001 06:32 AM
Re: sed batch editor - Change select lowercase areas from lower to upper case
VAR_CAP=`echo ${VAR_xx} | tr '[a-z]' '[A-Z]'`
federico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2001 11:02 AM
тАО02-26-2001 11:02 AM
Solution/.*\$IING\$...*/ {
h
s/.*\$IING\$\(..\).*/\1/
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
G
s/\(.*\)\n\(.*\$IING\$\)..\(.*\)/\2\1\3/
}
But that will only change the first occurance.
for every occurance you'll need something along these lines, which is written in awk:
/\$IING\$../ { for ( i=1;i<=NF;i++ ) {
if ( i != 1 ) printf(" ");
if ( $i ~ /\$IING\$../ ) {
s=toupper(substr($i,7));
printf("$IING$%s",s);
}
else { printf("%s",$i);}
}
}
But this will remove any special line formatting (white space) that there might be.