GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: awk ,sed script
Operating System - HP-UX
1847073
Members
5203
Online
110262
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
11-25-2002 10:16 PM
11-25-2002 10:16 PM
awk ,sed script
i can't reali understand what those scripts mean:
1)val=`sed -n '/[~!@#$%^&*() +-={}:";<>,.?/|]/p' temp`
2)cid=`awk -F: '$1 == "'$id'"' passwd`
3)id=`awk -F: '{print $1}' temp1`
4)update=`sed "/$id/s/$cpasswd/$confirm/" passwd`
thank you...
1)val=`sed -n '/[~!@#$%^&*() +-={}:";<>,.?/|]/p' temp`
2)cid=`awk -F: '$1 == "'$id'"' passwd`
3)id=`awk -F: '{print $1}' temp1`
4)update=`sed "/$id/s/$cpasswd/$confirm/" passwd`
thank you...
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2002 10:38 PM
11-25-2002 10:38 PM
Re: awk ,sed script
Hi Alice,
The easiest way to find out is to use examples :
1) Finds lines with "strange" characters in temp.
$more temp
ap
bp
+
-
/
ee
$val=`sed -n '/[~!@#$%^&*() +-={}:";<>,.?/|]/p' temp`
$echo $val
+ - /
2) Gets the line for a specific user from passwd.
$id=oracle
$cid=`awk -F: '$1 == "'$id'"' /etc/passwd`
$echo $cid
oracle:*:101:101:installation logon for oracle,,,:/oracle1/home/oracle/product/7
.2.2.3.0:/usr/bin/sh
... and so on ...
Remember that the scripts are easier to understand (for you and for us) if you also add the lines that fill up the variables ($id,$cpasswd,$confirm in the last example can mean anything for example).
Hope this gets you started.
Tom
The easiest way to find out is to use examples :
1) Finds lines with "strange" characters in temp.
$more temp
ap
bp
+
-
/
ee
$val=`sed -n '/[~!@#$%^&*() +-={}:";<>,.?/|]/p' temp`
$echo $val
+ - /
2) Gets the line for a specific user from passwd.
$id=oracle
$cid=`awk -F: '$1 == "'$id'"' /etc/passwd`
$echo $cid
oracle:*:101:101:installation logon for oracle,,,:/oracle1/home/oracle/product/7
.2.2.3.0:/usr/bin/sh
... and so on ...
Remember that the scripts are easier to understand (for you and for us) if you also add the lines that fill up the variables ($id,$cpasswd,$confirm in the last example can mean anything for example).
Hope this gets you started.
Tom
A life ? Cool ! Where can I download one of those from ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2002 10:46 PM
11-25-2002 10:46 PM
Re: awk ,sed script
Hi
1) print all lines with matching characters (don't print lines with only letters)
2) gives you the line from the file passwd (/etc/passwd??), there username matches the variable $id
3) gives you the first fields from a file (field delimiter is :), e.g if file temp1 is /etc/passwd than this line will print you all users
4) don't exactly know
Chris
1) print all lines with matching characters (don't print lines with only letters)
2) gives you the line from the file passwd (/etc/passwd??), there username matches the variable $id
3) gives you the first fields from a file (field delimiter is :), e.g if file temp1 is /etc/passwd than this line will print you all users
4) don't exactly know
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2002 12:44 AM
11-26-2002 12:44 AM
Re: awk ,sed script
Alice,
#4 is looking for the $id variable in passwd, and for any line that matches, it changes $cpasswd to $confirm. Every line is output unchanged.
However, the fact that you're equating this to a variable means that every line in the passwd file will get dumped into this variable, which may not be so useful.
Rgds, Robin
#4 is looking for the $id variable in passwd, and for any line that matches, it changes $cpasswd to $confirm. Every line is output unchanged.
However, the fact that you're equating this to a variable means that every line in the passwd file will get dumped into this variable, which may not be so useful.
Rgds, Robin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP