Sponsored Content
Full Discussion: need help!!!awk,grep,sed
Top Forums Shell Programming and Scripting need help!!!awk,grep,sed Post 302114448 by nokia1100 on Monday 16th of April 2007 06:42:45 AM
Old 04-16-2007
Question need help!!!awk,grep,sed

hi all

by using cat /etc/passwd
I've got these output.

ajh1ect:x:839:501:Anthony:/home/ajh1ect:/bin/bash
mjb1ect:x:840:501:Michael:/home/mjb1ect:/bin/bash
mv3ect:x:841:501:Marian:/home/mv3ect:/bin/bash

now I want to see just the user ID and group ID.
so what is the code will be with using awk, grep or sed?

the output should be like (as I just want to see the user ID and group ID)

839:501
840:501
841:501

requesting all for help.

Thank You
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed | Awk | Grep

Can someone help me in understanding when to use SED, AWK and GREP (3 Replies)
Discussion started by: kn.naresh
3 Replies

2. UNIX for Dummies Questions & Answers

Awk, Sed and Grep

Hello. I am an older newbie trying to learn Unix. I have a task to perform and it entails counting lines of code. Currently, I am pointing to the directory where the files are contained and performing a 'find' on the file extensions (cpp, c, html, java, etc.) and piping that info with a 'wc -l'.... (2 Replies)
Discussion started by: mastachef
2 Replies

3. UNIX for Dummies Questions & Answers

Grep Sed or Awk?

I have two .txt files one called good.txt and the other one is called bad.txt. Both contain email addresses in the following format: john@john.com bob@bob.com sarah@sarah.com Basically, I want to scrub good.txt against bad.txt and save the resulting output in scrubbed.txt meaning that if... (2 Replies)
Discussion started by: holyearth
2 Replies

4. UNIX for Dummies Questions & Answers

How could i get this by sed or grep or awk ????

------------------------------------------------------------------ Ex of Warning messgae,(Many similar lines occure for Both Test and Test1) -WARNING:Below Field not implemented in file File name: /home/test/ new/file1, msg buffer is: :Test:000948 ... (1 Reply)
Discussion started by: prsam
1 Replies

5. UNIX for Dummies Questions & Answers

awk grep sed or something better

Hello all, Can anyone help with the following? :) I have file1 with 150,000 words in a list and file2 with 148,000 words in a list - all of which are in file1. I want to create a new file with the words that DO NOT match (i.e of 2000 words). I have done this very simple command , which is... (1 Reply)
Discussion started by: dr_sabz
1 Replies

6. Shell Programming and Scripting

grep or awk or sed not sure which to use here

Hi All, I have a huge file, I need to two things from this file. I need to know the IP address or the hostname and second thing is the date&time. The file looks like this and I need to get my data from this... Trying... Connected to 204.109.172.117. Escape character is '^]'. Fri... (4 Replies)
Discussion started by: samnyc
4 Replies

7. Shell Programming and Scripting

help using sed/awk/grep

thanks for your reply. but i'm not quite sure what your code is doing. i may be using it wrong but i'm not getting what i'm supposed to get. could you please elaborate? thanks again, (6 Replies)
Discussion started by: kratos.
6 Replies

8. UNIX for Dummies Questions & Answers

grep/awk/sed?

Thread1 { x = 2 y = 10485 } Thread2 { x = 16 y = 1048 } Thread3 { x = 1 y = 1049 } Thread4 { x = 4 y = 1047 z = 500 } Suppose the above is a piece of code. I need to automate and verify that the value of x under Thread1's 2. There are several... (3 Replies)
Discussion started by: foxtron
3 Replies

9. Shell Programming and Scripting

grep? awk? sed? I don't know

Hi everyone! I have a file like this And I would like to find the Medium label when the value "last write" is "Jan 14" (it's could be another value like "jan 6") I really don't know what way to use to solve this problem... Thanks! (5 Replies)
Discussion started by: Castelior
5 Replies

10. Shell Programming and Scripting

Grep/awk/sed help

got a file as y.txt 1 abc,def,ghj 2 defj,abc.kdm,ijk 3 lmn,cbk,mno 4 tmp,tmop,abc,pkl 5 pri,chk,cbk,lmo 6 def,cbk.pro,abc.kdm i want to search in the above file the key word like abc looking for two outcomes by passing the parameter value as abc into function and the two outocmes are... (6 Replies)
Discussion started by: silgun
6 Replies
MHPATH(1)							     [nmh-1.5]								 MHPATH(1)

NAME
mhpath - print full pathnames of nmh messages and folders SYNOPSIS
mhpath [+folder] [msgs] [-version] [-help] DESCRIPTION
mhpath expands and sorts the message list `msgs' and writes the full pathnames of the messages to the standard output separated by new- lines. If no `msgs' are specified, mhpath outputs the current mail folder's pathname instead. If the only argument is `+', your nmh "Path" is output; this can be useful in shell scripts. Contrasted with other nmh commands, a message argument to mhpath may often be intended for writing. Because of this: 1) the name "new" has been added to mhpath's list of reserved message names (the others are "first", "last", "prev", "next", "cur", and "all"). The new message is equivalent to the message after the last message in a folder (and equivalent to 1 in a folder without mes- sages). The "new" message may not be used as part of a message range. 2) Within a message list, the following designations may refer to messages that do not exist: a single numeric message name, the single message name "cur", and (obviously) the single message name "new". All other message designations must refer to at least one existing message, if the folder contains messages. 3) An empty folder is not in itself an error. A message number less than that of the smallest existing message in a folder is treated as if the message already exists. A message number greater than that of the highest existing message in a folder causes an "out of range" error message to be displayed. As part of a range designation that contains messages that do exist, message numbers less than the smallest, or greater than the highest, existing message in a folder are ignored. Examples: The current folder foo contains messages 3 5 6. Cur is 4. % mhpath /r/phyl/Mail/foo % mhpath all /r/phyl/Mail/foo/3 /r/phyl/Mail/foo/5 /r/phyl/Mail/foo/6 % mhpath 2001 mhpath: message 2001 out of range 1-6 % mhpath 1-2001 /r/phyl/Mail/foo/3 /r/phyl/Mail/foo/5 /r/phyl/Mail/foo/6 % mhpath new /r/phyl/Mail/foo/7 % mhpath last new /r/phyl/Mail/foo/6 /r/phyl/Mail/foo/7 % mhpath last-new mhpath: bad message list last-new % mhpath cur /r/phyl/Mail/foo/4 % mhpath 1-2 mhpath: no messages in range 1-2 % mhpath first:2 /r/phyl/Mail/foo/3 /r/phyl/Mail/foo/5 % mhpath 1 2 /r/phyl/Mail/foo/1 /r/phyl/Mail/foo/2 mhpath is also useful in back-quoted operations: % cd `mhpath +inbox` % echo `mhpath +` /r/phyl/Mail FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
Path: To determine the user's nmh directory Current-Folder: To find the default current folder SEE ALSO
folder(1) DEFAULTS
`+folder' defaults to the current folder `msgs' defaults to none CONTEXT
None BUGS
Like all nmh commands, mhpath expands and sorts [msgs]. So don't expect mv `mhpath 501 500` to move 501 to 500. Quite the reverse. But mv `mhpath 501` `mhpath 500` will do the trick. Out of range message 0 is treated far more severely than large out of range message numbers. MH.6.8 11 June 2012 MHPATH(1)
All times are GMT -4. The time now is 02:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy