Sponsored Content
Top Forums Shell Programming and Scripting Modifying col values based on another col Post 302761317 by newbie83 on Friday 25th of January 2013 12:28:32 PM
Old 01-25-2013
I will try to run the code now with exported text, but naively looking at the code, it doesn't consider the keyword 'BAM' to be matched for both columns, is there another way that is being matched?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Help On col command

Hello Can Any1 tell me the difference between the col command and the col command with the -f option. I tried running both of them but i can't see any difference. Please guide me. (1 Reply)
Discussion started by: rahulrathod
1 Replies

2. UNIX for Dummies Questions & Answers

Info about col command

Hello every1. Can any1 help me with the col command. Wat is a reverse line feed. Which kind of files u need to use the col command. (2 Replies)
Discussion started by: rahulrathod
2 Replies

3. Shell Programming and Scripting

Awk to print distinct col values

Hi Guys... I am newbie to awk and would like a solution to probably one of the simple practical questions. I have a test file that goes as: 1,2,3,4,5,6 7,2,3,8,7,6 9,3,5,6,7,3 8,3,1,1,1,1 4,4,2,2,2,2 I would like to know how AWK can get me the distinct values say for eg: on col2... (22 Replies)
Discussion started by: anduzzi
22 Replies

4. Ubuntu

Match col 1 of File 1 with col 1 File 2 and create a 3rd file

Hello, I have a 1.6 GB file that I would like to modify by matching some ids in col1 with the ids in col 1 of file2.txt and save the results into a 3rd file. For example: File 1 has 1411 rows, I ignore how many columns it has (thousands) File 2 has 311 rows, 1 column Would like to... (7 Replies)
Discussion started by: sogi
7 Replies

5. Shell Programming and Scripting

i can't cut the third col

SW_dist_intr false Enable SW distribution of interrupts True autorestart true Automatically REBOOT OS after a crash True boottype disk N/A False capacity_inc 1.00 ... (7 Replies)
Discussion started by: maxim42
7 Replies

6. Shell Programming and Scripting

How to Delete the First Blank of the First Col?

Hi to all. In the following example, how can I delete the first blank of the first col? (using shell scripting) first second third fourth fifth sixth seventh eighth Thank's for reading. (5 Replies)
Discussion started by: daniel.gbaena
5 Replies

7. UNIX for Advanced & Expert Users

Print line based on highest value of col (B) and repetion of values in col (A)

Hello everyone, I am writing a script to process data from the ATP world tour. I have a file which contains: t=540 y=2011 r=1 p=N409 t=540 y=2011 r=2 p=N409 t=540 y=2011 r=3 p=N409 t=540 y=2011 r=4 p=N409 t=520 y=2011 r=1 p=N409 t=520 y=2011 r=2 p=N409 t=520 y=2011 r=3 p=N409 The... (4 Replies)
Discussion started by: imahmoud
4 Replies

8. Shell Programming and Scripting

Printing from col x to end of line, except last col

Hello, I have some tab delimited data and I need to move the last col. I could hard code it, awk '{ print $1,$NF,$2,$3,$4,etc }' infile > outfile but it would be nice to know the syntax to print a range cols. I know in cut you can do, cut -f 1,4-8,11- to print fields 1,... (8 Replies)
Discussion started by: LMHmedchem
8 Replies

9. Shell Programming and Scripting

How to mark the row based on col value.?

Hi Gurus, I have requirement to identify the records based on one column value. the sample file as below: ID AMT, AMT1 100,10, 2 100,20, 3 200,30, 0 200, 40, 0 300, 20, 2 300, 50, 2 400, 20, 1 400, 60, 0 for each ID, there 2 records, if any one record amt1 is 0, the in 4th col add... (5 Replies)
Discussion started by: ken6503
5 Replies

10. Emergency UNIX and Linux Support

Read values in each col starting 3rd row.Print occurrence value.

Hello Friends, Hope all are doing fine. Here is a tricky issue. my input file is like this 07 10 14 20 21 03 15 27 30 32 01 10 11 19 30 02 06 14 15 17 01 06 20 25 29 Logic: 1. Please print another column as "0-0-0-0-0" for the first and second rows. 2. Read the first column... (4 Replies)
Discussion started by: jacobs.smith
4 Replies
match(1)                                                        Mail Avenger 0.8.3                                                        match(1)

NAME
match - Match strings against glob paterns SYNOPSIS
match [-gilrqs] [-n <n>] [-c cmd] [-x code] {[-p] pattern | -f <file>} str1 [str2 ...] DESCRIPTION
match checks strings against pattern, which should be a shell-like glob pattern. pattern may contain the following special characters: ? A "?" character in pattern matches any single character in the string, except that the "/" character is only matched if match was given the -s option. * A "*" character in pattern matches zero or more characters in the string. The exception is that it will only match "/" characters if match was given the -s option. [...] A set of characters between square brackets matches any character in the set. In addition, the "-" character can be used to specify a range. For example "[+e0-3]" would match any of the characters "+", "e", 0, 1, 2, or 3 in the input string. To include a hyphen ("-") in the set of characters matched, either include the hyphen first or last, or escape it with a "". [!...] A character class preceded by a "!" matches any character but those specified in the class. The exception is that the negated character class will match a "/" only if match was given the -s option. c The backslash character escapes the next character c. Thus, to match a literal "*", you would use the pattern "*". match prints each string that matches pattern, one per line, and exits 0 if one or more strings matched. If no string matches, match exits with status 67 (or whatever alternate status was specified by the -x flag). If the -n n flag was specified, match prints only the text that matched the nth occurrence of "*" in the patten. OPTIONS -f file Specifies that the pattern should be read from file. match will read each line of the file and consider it as pattern to match against the argument strings. For each argument string, match stops when it hits the first matching line of the file. If file does not exist, match exits 67, or whatever code was specified by -x. -g Normally, the -n option selects text matching particular "*" characters in the patern. -g changes this behavior to use parentheses for grouping. Thus, for instance, the text "foo.c" would match pattern "*(.[ch])", and the output with option -n 1 would be ".c". To include a literal "(" or ")" in the pattern with the -g option, you must precede the character with a "". -i Makes the match case insensitive. str will be considered to match if any variation on its capitalization would match. For example, string "G" would match pattern "[f-h]". -l When a pattern matches the string in more than one way, the -l flag says to assign as much text as possible to the leftmost "*"s in the pattern. For example, pattern "*+*" would match text "a+b+c", and the first "*" would match "a+b". This behavior is the default, thus -l's effect is only to undo a previous -r flag. -n n With this flag, match prints the text that matched the nth "*" in the pattern, as opposed to printing the whole string. The leftmost "*" corresponds to -n 1. Specifying -n 0 causes match to print the whole matching string. Specifying -n -1 or using a value greater than the number of "*"s in the pattern causes match not to print anything, in which case you can still use the exit status to see if there is a match. The default value for n is 0, unless -g has also been specified, in which case the default is 1. -c command When -c is specified, match runs command with the system shell (/bin/sh), giving it as argument $0 the full string that matched, and as arguments $1, $2, etc., the parts of the string that matched any "*"s in pattern. If the command does not exit with status 0, match will exit immediately, before processing further matches, with whatever status command returned. The -c and -n flags are mutually exclusive. -p pattern Specifies the pattern to match against. The -p flag is optional; you can specify pattern as the first argument following the options. However, if you want to try matching the same input string against multiple patterns, then you must specify each pattern with a -p flag. -q This option is synonymous with -n -1; it suppresses output when there is a match. You can still determine whether a match occurred by the exit status. -r When a pattern matches the string in more than one way, the -r flag says to assign as much text as possible to the rightmost "*"s in the pattern. For example, with -r, pattern "*+*" would match text "a+b+c" with the "*" matching "a", and the second matching "b+c". -s Ordinarily, "*", "?", and negated character classes ("[!...]") do not match "/" characters. -s changes this behavior to match slashes. -x code By default, when there is no match, match exits with status 67. With this option, match exits with status code, instead. EXAMPLES
Suppose you have a directory with a bunch of files ending .c and .o. If, for each file named foo.c you want to attempt to delete the file foo.o, you can run the following command: match -p '*.c' -c 'rm -f $1.o' *.c Servers running the mailman list manager often send mail from bounce addresses of the form listname-bounces@host.com. If you subscribe to multiple lists on the same server, the mailman interface makes it easier if you subscribe under the same address. To split the mail into multiple folders based on the bounce address in the environment variable SENDER, you might chose a mailbox with the following shell code: name=`match -n1 "*-bounces@host.com" "$SENDER"` && echo "$HOME/Mail/incoming/host-$name.spool" SEE ALSO
avenger(1), avenger.local(8) The Mail Avenger home page: <http://www.mailavenger.org/>. AUTHOR
David Mazieres Mail Avenger 0.8.3 2012-04-05 match(1)
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy