Sponsored Content
Full Discussion: Awk -simple pattern matching
Top Forums Shell Programming and Scripting Awk -simple pattern matching Post 302453028 by bumblebee_2010 on Monday 13th of September 2010 10:35:16 PM
Old 09-13-2010
Awk -simple pattern matching

Find bumblebee and Megatron patterns (input2) in input1.
If it is + read input1 patterns from Left to Right
if it is - read input1 patterns from Right to Left
Y= any letter (A/B/C/D)


input1
Code:
c1	100	120	TF01_X1	+	AABDDAAABDDBCADBDABC	
c2	100	120	TF02_X2	-	AABDDAAABDDBCBACDBBC
c3	100	120	TF03_X2	+	AABDDAAABDDBCBADCBBC
c4	100	120	TF03_X3	+	AABDCAAABDDBCBADCBBC

input2
Code:
bumblebee	DBCADB	
Megatron	YDCY

output
Code:
c1	111	116	TF01_X1	+	bumblebee	DBCADB	AABDDAAABDDBCADBDABC
c2	118	115	TF01_X2	-	Megatron	ACDB	AABDDAAABDDBCBACDBBC
c3	115	118	TF01_X2	+	Megatron	ADCB	AABDDAAABDDBCBADCBBC
c4	100	120	TF03_X3	+	Megatron	BDCA	AABDCAAABDDBCBADCBBC
c4	100	120	TF03_X3	+	Megatron	ADCB	AABDCAAABDDBCBADCBBC

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK pattern matching, first and last

In a nutshell, I need to work out how to return the last matching pattern from an awk //,// search. I can bring back the first, but am unsure how to obtain the last, and a simple tail won't work as the match could be over multiple lines. Secondly I would like some way of pattern matching, a... (10 Replies)
Discussion started by: smb_uk
10 Replies

2. Shell Programming and Scripting

pattern matching using awk.

Dear Team, How do we match two patterns on the same line using awk?Are there any logical operators which i could use in awk like awk '\gokul && chennai\' <filename> Eg: Input file: gokul,10/11/1986,coimbatore. gokul,10/11/1986,bangalore. gokul,12/04/2008,chennai.... (2 Replies)
Discussion started by: gokulj
2 Replies

3. Shell Programming and Scripting

AWK pattern matching

Hi, How can I tell awk to print all lines/columns if column number 5 contains the word Monday? I have tried nawk -F, '$5==Monday' OFS=, myfile > outputfile but that doesn't work (I am a newb!!) Thanks, (7 Replies)
Discussion started by: keenboy100
7 Replies

4. UNIX for Dummies Questions & Answers

awk - pattern matching?

Hello all, I am trying to sort thru a database and print all the customers whose first names are only four characters. I just want to pull the first name only from the database. the database records appear like this in file: Mike Harrington:(510) 548-1278:250:100:175; first is name Mike... (4 Replies)
Discussion started by: citizencro
4 Replies

5. Shell Programming and Scripting

AWK pattern matching on loop

Hi, I am still a beginner on shell scripting so please bear with me. What i am trying to do is filter my logfile based on some ID on field 24 which is defined in array. The filter result output will be moved to my log folder with the same name. The problem is when not using loop, this command... (2 Replies)
Discussion started by: howielim
2 Replies

6. Shell Programming and Scripting

awk pattern matching on ssh

Hi folks, i am trying to filer some log file using awk command. When i try it on remote server, it can show the result. awk '$1=="2012-10-29" && $4==17353' somelogfile But when i try to execute it from ssh, it cannot show the same result. ssh someserver "awk '\$1=="2012-10-28" &&... (7 Replies)
Discussion started by: howielim
7 Replies

7. Shell Programming and Scripting

awk pattern matching

can somebody provide me with some ksh code that will return true if my the contents in my variable match anyone of these strings ORA|ERROR|SP2 variable="Error:ORA-01017: Invalid username/password; logon denied\nSP2-0640:Not connected" I tried this and it does not seem to work for me ... (3 Replies)
Discussion started by: BeefStu
3 Replies

8. Shell Programming and Scripting

awk pattern matching name in records

Hi, I'm very new to these forums. I was wondering if someone could help an AWK beginner with a pattern matching an actor to his appearance in movies, which would be stored as records. Let's say we have a database of 4 movies (each movie a record with name, studio + year, and actor fields with... (2 Replies)
Discussion started by: Jill Ceke
2 Replies

9. Shell Programming and Scripting

Pattern matching using awk

Hi I am trying to find a pattern match with column one containing 3 numbers. input file tmp.lst abcd456|1|23123|123123|23423 kumadff|a|dadfadf|adfd|adfadfadf xxxd999|d|adfdfs|adfadf|adfdasfadf admin|a|dafdf|adfadfa||| output file tmp4.lst abcd456|1|23123|123123|23423... (3 Replies)
Discussion started by: vamsekumar
3 Replies

10. Shell Programming and Scripting

awk pattern matching

I have two files, want to compare file1 data with file2 second column and print line which are not matching. Need help in matching the pattern, file2 second column number can be leading 0 or 00 or 000. Example: file1 1 2 3 file2 a,0001 b,02 c,000 d,01 e,2 f,0005 Expected output:... (20 Replies)
Discussion started by: vegasluxor
20 Replies
MINCCONCAT(1)							 MINC User's Guide						     MINCCONCAT(1)

NAME
mincconcat - concatenate minc files along a specific dimension SYNOPSIS
mincconcat [<options>] <infile1>.mnc [<infile2>.mnc ...] <outfile>.mnc DESCRIPTION
Mincconcat will concatenate a number of minc files together, producing a single output file. The concatenation is done along a specified dimension, with the slices being sorted into ascending order. The concatenation dimension can either be a dimension in the file, in which case coordinates for sorting are taken directly from the input files, or it can be a new dimension and the coordinates are specified with a command-line option. OPTIONS
Note that options can be specified in abbreviated form (as long as they are unique) and can be given anywhere on the command line. General options -2 Create a MINC 2.0 format output file. -clobber Overwrite an existing file. -noclobber Don't overwrite an existing file (default). -verbose Print out progress information for each chunk of data copied (default). -quiet Do not print out progress information. -max_chunk_size_in_kb size Specify the maximum size of the copy buffer (in kbytes). Default is 4096 kbytes. -filelist filename Specify a file containing a list of input file names. If "-" is given, then file names are read from stdin. If this option is given, then there should be no input file names specified on the command line. Empty lines in the input file are ignored. Output type options -filetype Don't do any type conversion (default). -byte Write out 8-bit integer voxels. -short Write out 16-bit integer voxels. -int Write out 32-bit integer voxels. -long Superseded by -int. -float Write out single-precision floating point values. -double Write out double-precision floating point values. -signed Write out values as signed integers (default for short and long). Ignored for floating point types. -unsigned Write out values as unsigned integers (default for byte). Ignored for floating point types. -valid_range min max Specifies the valid range of output voxel values in their integer representation. Default is the full range for the type and sign. This option is ignored for floating point values. Concatenation options -concat_dimension name Specifies the name of concatenation dimension. If the dimension exists in the input files, then coordinates are taken from those files. If not, then a new dimension is created and the coordinate for each input file is taken from command-line options. The default is to use the slowest varying dimension of the first file. -start start Specifies the starting coordinate for the new dimension (default = 0.0). -step step Specifies the separation between voxels for the new dimension (default = 1.0). -width width Specifies the (constant) width of each sample along the new dimension (default = none). -coordlist c1,c2,... Specifies a comma-separated list of coordinates along the new dimension. -widthlist w1,w2,... Specifies a comma-separated list of widths along the new dimension. -filestarts s1,s2,... Specifies a comma-separated list of offsets to the coordinate origins for each of the files listed on the command line. This option is useful for concatenating files along an existing dimension, for example for concatenating multiple functional runs along a time dimension. -check_dimensions Check that all input files have matching sampling in world dimensions (default). -nocheck_dimensions Ignore any differences between input files in world dimensions sampling. -ascending Sort coordinates in ascending order (default). -descending Sort coordinates in descending order. -interleaved Sort slabs by their dimension coordinate, interleaving if necessary (default). -sequential Don't sort slabs, just concatenate them together. WARNING - this will destroy the dimension information along the concatenating dimension, replacing the start and step with zero and one. Generic options for all commands: -help Print summary of command-line options and exit. -version Print the program's version number and exit. EXAMPLES
To concatenate two volumes with dimensions zspace, yspace, xspace, having interleaved slices along zspace, we can simply use mincconcat input1.mnc input2.mnc output.mnc If we have a bunch of compressed (yspace, xspace) images that we wish to concatenate into an evenly spaced volume, then we can type mincconcat input1.mnc.gz input2.mnc.gz input3.mnc.gz input4.mnc.gz output.mnc -concat_dimension zspace -start -23 -step 2 AUTHOR
Peter Neelin COPYRIGHTS
Copyright (C) 1995 by Peter Neelin $Date: 2005-07-15 17:38:08 $ MINCCONCAT(1)
All times are GMT -4. The time now is 03:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy