LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-22-2003, 10:04 AM   #16
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47

May I point out that Perl is your friend in such situations...

Jamie...
 
Old 04-22-2003, 01:51 PM   #17
uribo
LQ Newbie
 
Registered: Apr 2003
Posts: 11

Original Poster
Rep: Reputation: 0
but i can only use bourne scripting...
 
Old 04-23-2003, 01:42 AM   #18
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
Quote:
Originally posted by uribo
hi moses,

one question --> how can i update shadow file after insert "*" in "mark" field?

i tried:

cat /etc/shadow | awk -F: '{ if ($1 == "mark") print $1FS"*"FS$3FS$4FS$5FS$6FS$7FS$8FS}' > temp.doc && mv temp.doc /etc/shadow

& it replace the whole file content with only "mark" entry.

thanks
To be honest, I think my "solution" is really quite ugly and though it works you should look for something more elegant (this was just a quick response answer)
Anyway, you are almost there. . .

Code:
awk -F: '{if ($1 == "mark") $2 = "*"} { print $1FS$2FS$3FS$4FS$5FS$6FS$7FS$8FS}' shadow
This is still ugly and if I bothered to read the manual page I could find the right way to do it, but I'm too lazy.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Divide up lines with string delimiter elmu Programming 3 10-07-2005 08:48 AM
getline delimiter + move to next line? blizunt7 Programming 3 07-09-2005 12:08 AM
c++ get() delimiter ashirazi Programming 3 08-06-2004 05:26 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM
tab delimiter codename000 Programming 3 04-04-2003 10:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration