- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Operating System - Tru64 Unix
- >
- Re: How to add a field with sed
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-2004 04:12 AM
тАО09-10-2004 04:12 AM
Here's my problem. I have a colon(:) separated file which I have to add a field to the end of the 1st line. For example, the end of the 1st line might look like this:
...:u_minchg#86400:\
and I want it to look like this:
...:u_minchg#86400:u_nullpw@:\
I tried several things and the closest (I think) I got is:
sed "1s/:\$/u_nullpw@:\/"
but it doesn't work, the file remains unchanged. Help!
Thanks,
Vic
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 05:12 AM
тАО09-10-2004 05:12 AM
Re: How to add a field with sed
Ann
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 05:23 AM
тАО09-10-2004 05:23 AM
Re: How to add a field with sed
I did try that but for some reason adding the u_nullpw@ field at the end doesn't work. It worked when I tried adding it to the end of the 1st line thus the question.
Problem with the 1st line is there nothing that's the same from account to account and I have to do this for all accounts. Besides, I'd like to figure how to do this stupid thing with sed. :-)
Thanks,
Vic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 05:49 AM
тАО09-10-2004 05:49 AM
Re: How to add a field with sed
It shouldn't matter where in the entry the u_nullpw@ is, as long as it is before the chkent entry (chkent is used to indicate the end of the entry).
I'm wondering why you want to set u_nullpw@ in the individual accounts, though. It makes more sense to have it in the default file and put the entry u_nullpw just on the accounts that you want to be able to not have a password.
Ann
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 05:59 AM
тАО09-10-2004 05:59 AM
Re: How to add a field with sed
I'll try to make a long story short (hopefully :). Management wants to 'lock down' or in other words 'make more secure' all accounts on all our Alphas for better security. Some of these systems have been around for years and I ended up 'inhereting' them. Don't know what has been set and what hasn't been. So, I decided the safest thing to do is set all fields the way we want them to be.
From some testing that I did it seems that when you set a field to a value that's the same in the default local template, it won't be saved in the user's record. That field is removed from the user's record, or at least the fields that I tested on.
Vic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 06:58 AM
тАО09-10-2004 06:58 AM
Re: How to add a field with sed
It still makes more sense to me to update the default file with the fields that you want for all accounts, and then maybe scan all the accounts to make sure they don't have something different that overrides the default, but to each his own...
I played with edauth some (system is V5.1a PK6), and what I see is that if I use edauth interactively the field gets added to the user's extended profile entry and it doesn't matter whether it already exists in the default file or where I add it in the user's entry. If I use the edauth -g | sed | edauth -s sequence trying to append the field before the chkent field it does not get added to the user's entry whether or not it exists in the default file. If I try to add the field elsewhere in the user's entry it does get added to the user's entry. Sure looks broken to me.
Ann
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 07:25 AM
тАО09-10-2004 07:25 AM
Re: How to add a field with sed
Thanks for your time on this matter. Since we're talking about 100's of accounts, we're going to do it en masse.
Still would like to know how the sed command should look like. Anybody know of a 'sed for Dummies' manual? :-)
Vic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2004 07:44 AM
тАО09-10-2004 07:44 AM
Solution# edauth -g testme | sed '1s/\\/u_nullpw@:\\/' | edauth -s
The problem with this one is that it assumes that all accounts will be printed out as multiple lines with at least the first ending in \. From doing an edauth -g on my system, it looks like edauth -g prints out all accounts as at least 2 lines, but I don't think that behavior is guaranteed.
Ann
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2004 04:13 AM
тАО09-12-2004 04:13 AM
Re: How to add a field with sed
However:
- The sed command needs to be enclosed in single quotes.
- The backslash is an 'escape' character and needs to be escapsed itself by doubling up.
- If you include the colon in the match, then you'd better put it back
- The line number is not needed
- The rest is fine :-).
Here is the test I used. Seems to work for me:
edauth -g | head | sed 's/\\$/u_nullpw@:\\/'
Hein.