Sponsored Content
Top Forums Shell Programming and Scripting Grep command giving different result for different users for same command Post 302947493 by RudiC on Thursday 18th of June 2015 09:54:25 AM
Old 06-18-2015
Escape the double quotes around the search pattern.

BTW, I'd be surprised if the result of the first command were "12" only...

Last edited by RudiC; 06-18-2015 at 11:04 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assign subst|grep|sed command result to a variable

Hi, I'm quite new to scripting and I want to modify following line of an existing script: MYVAR=`subst |grep 'L:\\\:' | sed -e 's/.*\\\//'`; What I have to do is to use the content of a variable instead of the constant expression 'L:\\\:' as the grep string to be matched. Assuming I already... (5 Replies)
Discussion started by: snowbiker99
5 Replies

2. Linux

Terminal Execution By Giving a Command

Hi Guys, I am using Red Hat Linux 5 and GNOME Terminal is available there in the Accessories menu of Applications. But I don't see any run command option which can be used to type the name of the terminal and execute it directly as I used to do it under Mandrake Linux wherein I would type... (2 Replies)
Discussion started by: indiansoil
2 Replies

3. Shell Programming and Scripting

Last Command not giving year

Hi All, i want the last login details along with year. i tried below command but not giving me the year of last login. last <$Userid> | head -1 i heard that if it is current year then it wont display the year else it will display the year. is it so? if yes then , is there any way of... (1 Reply)
Discussion started by: ani_rvce
1 Replies

4. UNIX for Dummies Questions & Answers

Last Command not giving year

Hi All, i want the last login details along with year. i tried below command but not giving me the year of last login. last <$Userid> | head -1 i heard that if it is current year then it wont display the year else it will display the year. is it so? if yes then , is there any way of... (1 Reply)
Discussion started by: ani_rvce
1 Replies

5. Linux

acroread command giving error

Hi, When I run the command acroread it is giving error ERROR: Cannot find installation directory. When I look at /usr/local/Adobe/Acrobat7.0/bin/ an exicutable file named acroread is there. When i run ./acroread from that directory it is working . What can i do so that I can give... (3 Replies)
Discussion started by: iamjayanth
3 Replies

6. Shell Programming and Scripting

Use grep result to execute next command

Hi I am trying to run 2 servers using a script one after the other. I start the first one: run.sh -c servername >> jboss_log.txt & Then I have to wait until I see Started message in the log file before I launch the other server. I can't use sleep because I am not sure how long it'll... (5 Replies)
Discussion started by: iririr
5 Replies

7. Shell Programming and Scripting

If the grep command returns any result set

my intension is to use a grep command inside the shell script and if any row is returned or not.. depending on the resultset i have to code on further. how to check this i mean.. could anyone help me out with the if condition how to use it here !! (4 Replies)
Discussion started by: gotam
4 Replies

8. Shell Programming and Scripting

Grep result from dd command

Hi, I am running following command in a bash script for testing IO and use grep to get throughput number, but it did not work, it displayed everything: dd if=/dev/zero of=/dev/null bs=1G count=1 oflag=dsync | grep bytes | awk '{print $7}' 1+0 records in 1+0 records out 536870912 bytes... (2 Replies)
Discussion started by: hce
2 Replies

9. Shell Programming and Scripting

CUT command not giving correct result inside loop

Hi, i have a source file and have 3 columns and separated by "|" .i want to split this 3 columns in different variable.When i am executing this values indivisually giving correct result but when the same execute inside a for loop,it's giving issues. Src file(jjj.txt) -------... (8 Replies)
Discussion started by: raju2016
8 Replies

10. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies
pick(1) 						      General Commands Manual							   pick(1)

NAME
pick - select messages by content (only available within the message handling system, mh) SYNOPSIS
pick [+folder] [msgs] [options] OPTIONS
Searches for messages sent after the specified date. This command can be used with pattern-matching options, and also in conjunction with the -before option to specify a date range. The date must be enclosed in double quotes ("). This option accepts RFC 822-style dates. It also accepts days of the week, and the special dates today and yesterday. Days of the week always refer to days in the past; for example, saturday refers to last Saturday, not to next Saturday. If you specify a day of the week or a special date, pick counts days as 24-hour periods relative to the current day and time. For example, if it is 9:30 A.M. on 11 July 1995 and you specify -after yesterday, the pick command finds messages sent after 24 hours ago, or 9:30 A.M. on 10 July 1995. By default, pick consults the Date: field of the message. If you wish to use the date in another header field, you can specify this with the -datefield option. Searches for messages sent before the specified date. This command can be used with pattern-matching options, and also in conjunction with the -after option to specify a date range. The date must be enclosed in double quotes ("). This option accepts RFC 822-style dates. It also accepts days of the week, and the special dates today, tomorrow, and yesterday. Days of the week always refer to days in the past; for example, saturday refers to last Saturday, not to next Saturday. If you specify a day of the week or a special date, pick counts days as 24-hour periods relative to the current day and time. For example, if it is 9:30 A.M. on 11 July 1995 and you specify -before yesterday, the pick command finds messages sent before 24 hours ago, or 9:30 A.M. on 10 July 1995. By default, pick consults the Date: field of the message. If you wish to use the date in another header field, you can specify this with the -datefield option. Searches for the specified pattern in the cc: field of messages. This option is case-insensitive: lower- and upper-case letters are treated as identical. So a search for the pattern phillips would also find Phillips and PHILLIPS. If the pattern contains spaces, you must enclose it in double quotes ("). Searches for messages sent on a specified date. This option consults the Date: field of messages. You must enclose the date that you give in double quotes (") if it contains spaces. Specifies the header field to be used by the -before and -after options. By default, these options consult the Date: field of the message header. You can specify a different header field by naming it with this option. The -datefield option must precede the -before or -after options it is used with. Searches for the specified pattern in the From: field of messages. This option is case- insensitive: lower- and upper-case letters are treated as identical. So a search for the pattern phillips would also find Phillips and PHILLIPS. If the pattern contains spaces, you must enclose it in double quotes ("). Prints a list of the valid options to this command. The -list option lists the numbers of the messages that have met the search criteria. This is the usual default behavior of pick. If you use the -nolist option, pick indicates how many messages met the search criteria. If you use the -sequence option to add the messages found to a sequence, the default behavior is to use the -nolist option. Sets the read permissions of sequences. Normally, when you create a sequence with the -sequence option, the sequence will not be accessi- ble to other MH users. The -public option makes the sequence accessible to other MH users. You can use the -nopublic option to ensure that the sequence that you create is only accessible to yourself. Searches the entire message for the specified string. Each line of the message is searched for the pattern that you specify. The -search option is a modified grep(1). Like grep, this option is case-sensitive; it treats upper- and lower-case letters as different. So a search for the word strawberries would not find a mes- sages which contained the word STRAWBERRIES. If the search pattern contains spaces, you must enclose it in double quotes ("). Specifies a sequence in which pick places the messages found. For more information on sequences, see mark(1). The name of the sequence must begin with a letter, and must consist entirely of alphabetic or numeric characters; no punctuation is allowed. Searches for the specified pattern in the Subject: field of messages. This option is case-insensitive: lower- and upper-case letters are treated as identical. So a search for the pattern phillips would also find Phillips and PHILLIPS. If the pattern contains spa- ces, you must enclose it in double quotes ("). Searches for the specified pattern in the To: field of messages. This option is case-insensitive: lower- and upper-case letters are treated as identical. So a search for the pattern phillips would also find Phillips and PHILLIPS. If the pattern contains spaces, you must enclose it in double quotes ("). Specifies whether to zero existing sequences before adding new messages. Normally, pick removes all existing messages from a sequence before adding messages to it. If you specify the -nozero option, pick will add the messages it finds to the existing contents of the sequence. This option only works with the -sequence option. Searches a specified header field. If you wish to search for a pattern in a particular header field, you can specify the field by placing two dashes (-) before the name of the field. This option is case-insensitive: lower- and upper-case letters are treated as identical. So a search for the pattern phillips would also find Phillips and PHILLIPS. If the pattern con- tains spaces, you must enclose it in double quotes ("). The pick command recognizes the following common header fields: To:, cc:, Date:, From:, and Subject:. You can search these fields by preceding the name with one dash only. In addition to the above options, you can direct pick to start its search a specified number of days ago. To do this, precede the number of days with a dash (-). The pick command counts days as 24-hour periods relative to the current day and time. For example, if it is 9:30 A.M. on 11 July 1995 and you specify -10, the following pick command finds messages sent before 240 hours ago, or 9:30 A.M. on 30 June 1995: % pick -subject strawberries -10 1 6 The pick command also supports complex boolean operations. The -not, -or and -and options allow you to modify the behavior of pattern- matching options. In the following command, the -not option means that pick searches for messages that were not from fred: % pick -not -from fred In the next example, the -or option finds all messages from fred or from david. If the -or option is not used, pick searches for messages with both the string fred and the string david in the From: field. % pick -from fred -or -from david The pattern-matching options normally take precedence over -not, which in turn takes precedence over -and, which in turn takes precedence over -or. You can override the default precedence with the -lbrace and -rbrace options. These act just like opening and closing parentheses in logi- cal expressions. DESCRIPTION
The pick command lets you search messages in a folder on a diverse range of search criteria. You can search the mail headers or the text of some or all of the messages within a folder for the specified criteria. You can use pattern matching or date constraint operations. You can use the messages that you find with other MH commands, or you can place them in a sequence. By default, pick searches all the messages in the current folder. You can specify a folder other than the current folder using the +folder- name option. Also, if you do not want to search all messages within the folder, you can specify more than one message or a range of mes- sages using the message numbers. You can search on the contents of the most common header fields by giving the name of the field as an option, preceded by a dash (-). The pick command allows you to specify the following header fields in this way: To:, cc:, Date:, From:, and Subject:. You can also search the contents of any other header field by preceding the name of the field with two dashes. The pick also allows you to introduce time constraints. You can search for messages sent before, after, or between specified dates. Combining pick with Other Commands You can combine the output of pick directly with any MH command. by using a technique called back-quoting. Enclose the pick command and its associated arguments and options in back quotes (`). The system performs back-quoted commands first. In the following example, the pick command is performed first, and the output is then listed by the scan command: % scan `pick -from jones` 3 16/01 jones Meeting 10.00 tomorrow<<There wi 17 22/01 jones Minutes of meeting 16/1<<Any com 21 01/02 jones Next week's meeting canceled<<T If pick finds that there is no mail from Jones, it will output the illegal character 0. This will cause the scan command to fail grace- fully. You can use back-quoting to combine pick with any MH command. For more information on back-quoting, see the reference page for your shell; for example, csh(1) or sh(1). RESTRICTIONS
The sequence name, punctuation and message list must not exceed 1024 characters. In practice, this gives a reasonable limit of approxi- mately 200 non-consecutive messages in a sequence. PROFILE COMPONENTS
Path: To determine your Mail directory EXAMPLES
The first example finds all the mail in the current folder that was sent by Christine: % pick -from christine 1 3 8 In the next example, pick searches messages 10-20 in the +sent folder for messages that were sent to Kafka: % pick +sent 10-20 -to Kafka pick: no messages match specification The next example finds all messages from Jack, and places them in a sequence called testing: % pick -from Jack -sequence testing 3 hits The next example finds all messages sent to Holloway since 10th June: % pick -to holloway -after "10 Jun 1990" 19 FILES
The user profile. SEE ALSO
csh(1), ed(1), grep(1), sh(1), inc(1), mark(1) pick(1)
All times are GMT -4. The time now is 04:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy