Sponsored Content
Top Forums UNIX for Dummies Questions & Answers correct syntax for using "grep regex filename" ? Post 74809 by Kelam_Magnus on Monday 13th of June 2005 02:39:15 PM
Old 06-13-2005
The problem is that no line starts with yong, when using the long listing the file name is the last field on the far right... Dont use the ^ in your listing it is irrelevant.


ls -al | xargs| grep 'yong_ho_[1-9]'
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

correct use of "ps -ef | grep "?

I am trying to run a program which checks to see if a process is running. If the process is not running, I want to start (re-start) the process. If the process is still (already) running, do nothing. Here is the process; it starts manually: $java Validation here is my code to see if it is... (1 Reply)
Discussion started by: mulligm
1 Replies

2. Shell Programming and Scripting

Pls correct the "if" syntax

Iam a learner of UNIX. Fortunately I got this site. I want to check the file for its existance. if echo " Not present" else echo "Present" fi The above code is working fine. But I also want to check for the files which are compressed. I tried the following code and it is not... (5 Replies)
Discussion started by: ganapati
5 Replies

3. Shell Programming and Scripting

Unix shell script (grep -A 6 -B 2 "ORA-" filename

BACKGROUND: I am using Solaris 10. Some of my boxes have gnu grep and I can use -A and -B flags on those. However, the solaris flavor of grep won't use the flags -A or -B. And some of my boxes won't be getting gnu grep. Should I try using perl, awk, or sed? Actual PROBLEM: I am... (7 Replies)
Discussion started by: el_guero
7 Replies

4. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

5. Shell Programming and Scripting

What's the correct syntax to use "if-else"

hi, i'm a beginner in Linux, actually i use andLinux, i have a data file with 11 columns 170 N SER T 25 56.962 42.701 -133.423 1.00 87.04 N 171 CA SER T 25 57.076 41.790 -132.280 1.00 86.65 C 172 C SER T 25 57.766 40.492 -132.692 1.00 87.52 C 173 O SER T 25 58.653 39.988 -131.992 1.00 86.59... (6 Replies)
Discussion started by: elsa
6 Replies

6. Shell Programming and Scripting

Need Correct syntax for "if" in UNIX

I am trying to write a simple if statement but that driving me crazy:eek: with syntactical erorrs. This is what I managed to come up #!/bin/ksh USERNAME=`whoami` if ;then echo " you have logged in as report user" elif ; then echo " you have logged in as extract user" else " I dont... (3 Replies)
Discussion started by: kkb
3 Replies

7. Shell Programming and Scripting

ps -ef | grep "string1" "string2" " "string3"

Hi all, can any one suggest me the script to grep multiple strings from ps -ef pls correct the below script . its not working/ i want to print OK if all the below process are running in my solaris system. else i want to print NOT OK. bash-3.00$ ps -ef | grep blu lscpusr 48 42 ... (11 Replies)
Discussion started by: steve2216
11 Replies

8. UNIX for Dummies Questions & Answers

"tail -n 1 filename" error while "head -n 1 filename" is ok?

Hi all, I was wondering why tail -n 2 filename produce an error when I manage to do similar command on head -n 2 filename SunOS{type8code0}: tail -n 2 filename usage: tail ] tail ] (2 Replies)
Discussion started by: type8code0
2 Replies

9. Shell Programming and Scripting

grep regex, match exact string which includes "/" anywhere on line.

I have a file that contains the 2 following lines (from /proc/mounts) /dev/sdc1 /mnt/backup2 xfs rw,relatime,attr2,noquota 0 0 /dev/sdb1 /mnt/backup xfs rw,relatime,attr2,noquota 0 0 I need to match the string in the second column exactly so that only one result is returned, e.g. > grep... (2 Replies)
Discussion started by: jelloir
2 Replies

10. Shell Programming and Scripting

regex, awk, grep question "how to"

I've been working on this for 2 days and I'm not getting far. It is time to turn to you guys. With the data below, I am trying to create a file that looks like this: I'd like to use some form of egrep I think. AY#box#P04prod_to_contingency s AY#cmd#P04dump_cont_db s AY#cmd#P04get_on_ice_job s... (2 Replies)
Discussion started by: rawbi01
2 Replies
scan(1mh)																 scan(1mh)

Name
       scan - produce a one-line-per-message scan listing

Syntax
       scan [ +folder ] [ msgs ] [ options ]

Description
       The command produces a one-line-per-message listing of the messages in the current folder.

       You can scan a folder other than the current folder by using the +folder argument.  You can use the msgs argument to produce a scan listing
       of a number of messages or a range of messages in the specified folder.	You can also use in conjunction with a message sequence defined by
       or See for more information on sequences.

       Each line contains the message number, the date, the From: field, the Subject: field, and, if room allows, some of the body of the message.
       The current message is marked with a plus sign (+).

       The command actually reads each of the specified messages and parses them to extract the desired fields.  If format errors are found in any
       of the messages during parsing, produces appropriate error messages.

       Because MH has been configured with the BERK option, has two additional options: -reverse and -noreverse.  In addition, updates the MH con-
       text prior to starting the listing, so interrupting a long listing preserves the new context.  The default configuration file that is  sup-
       plied with MH has the BERK option enabled.

       If  encounters  a  message  without  a  Date:  field, the date is filled in with the last write date of the message, and an asterisk (*) is
       appended.  This is useful for identifying unsent message drafts.  Unsent drafts are not usually allowed to contain a Date: field,  and  are
       consequently marked with an asterisk in listings.

Options
       -clear
       -noclear  Directs  to  clear the screen.  If the -clear switch is used and the output of is directed to a terminal, then consults the $TERM
		 and $TERMCAP environmental variables to determine your terminal type in order to find out how to clear the screen prior to  exit-
		 ing.  If the -clear switch is used and the output of is not directed to a terminal, then sends a formfeed prior to exiting.

       -form formatfile
		 Re-formats  the  output  of according to the instructions in the named file.  The named formatfile must be in style; see for more
		 details.

       -format string
		 Re-formats the output of according to the instructions in the string given.  The string must be in style; see for  more  details.
		 You must place the string argument to this command in double quotes (").

       -header
       -noheader Produces a header line prior to the listing.  The header line displays the name of the folder and the date and time.  This can be
		 suppressed using the -noheader option.

       -help	 Prints a list of the valid options to this command.

       -reverse
       -noreverse
		 Lists the output from in reverse order, from the highest message number to the lowest.  The -noreverse option lists  messages	in
		 the conventional way, from lowest to highest numbers.	The -noreverse option is the default.

       -width columns
		 Specifies the width of your screen, in columns.

       The defaults for this command are as follows:

	      +folder defaults to the current folder
	      msgs defaults to all
	      -noheader
	      -width defaults to the width of the terminal

Examples
       The following example produces a listing of messages 11 through 15 in the folder
       % scan +inbox 11-15
	 11  18/01 ralph	      Project Plan Meeting Monday<<This
	 12 -21/01 johnson	      squash<<Thought i might postpone
	 13  21/01 smith@ultrixhost   support from US during conversion
	 14  21/01 jjones@subone.dne  new forum for discussion of mail
	 15+ 21/01 calvin@hobbes.uuc  Re: new forum for discussion of m
       In this listing, the plus sign (+) on message 15 indicates that it is the current message.  The hyphen (-) on message 12 indicates that you
       have replied to the message.  It is produced by the -annotate option to see for more information.  If there is sufficient room left on  the
       line after the subject, fills the line with text from the body, preceded by <<, and terminated by >> if the body is sufficiently short.

Profile Components
       Path:		      To determine your Mail directory
       Alternate-Mailboxes:   To determine your mailboxes

Files
       The user profile.

See Also
       inc(1mh), mark(1mh), pick(1mh), show(1mh), mh-format(5mh)

																	 scan(1mh)
All times are GMT -4. The time now is 03:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy