- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: inserting delimiters
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
тАО10-23-2008 07:43 PM
тАО10-23-2008 07:43 PM
Re: inserting delimiters
$ perl -lpe'($u,$f)=split /\W/; $_=join q(,),$u,split(//,$f)'
Really is...
while ($line =
($user, $flags) = split (/\W/, $line);
@letters = split(//, $flags);
$new_line = join ',' , $user, @letters;
print $new_line, "\n";
}
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2008 07:57 PM
тАО10-23-2008 07:57 PM
Re: inserting delimiters
Thanks for the notes Hein! Will likely to play and consider it in the code too
Cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2008 08:07 PM
тАО10-23-2008 08:07 PM
Re: inserting delimiters
>echo 'user1,YNNNNNNNNN' | \
sed -e 's/,/ /' -e 's/\([NY]\)/\1 /g' -e 's/ /,/g' -e 's/,$//g'
It is obvious this isn't going to work if the user name is like "YESNO".
I'm also not sure why you want to change to spaces then back?
Note: the "g" in 's/,$//g' is useless.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2008 09:48 PM
тАО10-23-2008 09:48 PM
Re: inserting delimiters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2008 10:24 PM
тАО10-23-2008 10:24 PM
Re: inserting delimiters
awk -F, '
{
printf $1 ","
for (i=1; i < 20; ++i)
printf substr($2,i,1) ","
print substr($2,20,1)
} '
- Tags:
- awk
- « Previous
-
- 1
- 2
- Next »