Sponsored Content
Top Forums Shell Programming and Scripting Combine multiple lines in file based on specific field Post 302669763 by elixir_sinari on Wednesday 11th of July 2012 09:48:21 AM
Old 07-11-2012
Code:
paste -sd'\t' inputfile|sed 's/        ABC/\
ABC/g'

Use the Tab key between "/" and "ABC".
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

add lines automatically based on a field on another file

hello I have a number of lines that need to be added at the end of a file each time I add a field in another file (let's name it file2) file2 has this format: filed1:field2:path1:path2:path3:path... Whenever I add a path field, I should add to file1 these lines: <Location path1>... (0 Replies)
Discussion started by: melanie_pfefer
0 Replies

2. Shell Programming and Scripting

Split a file into multiple files based on field value

Hi, I've one requirement. I have to split one comma delimited file into multiple files based on one of the column values. How can I achieve this Unix Here is the sample data. In this case I have split the files based on date column(c4) Input file c1,c2,c3,c4,c5... (1 Reply)
Discussion started by: manasvi24
1 Replies

3. Shell Programming and Scripting

Combine multiple unique lines from event log text file into one line, use PERL or AWK?

I can't decide if I should use AWK or PERL after pouring over these forums for hours today I decided I'd post something and see if I couldn't get some advice. I've got a text file full of hundreds of events in this format: Record Number : 1 Records in Seq : ... (3 Replies)
Discussion started by: Mayday22
3 Replies

4. Shell Programming and Scripting

File Parsing based on a character in a specific field

Hi All, I'm having a hard time finding a starting point for my issue. I have a 30k line file (fspsec.txt) that I would like to parse into smaller files based on any character existing in field 1. ACCOUNTANT LEVEL 1 (ACCT.ACCOUNTANT) OPERATORS: DOEJO (418) TOOLS: Branch Maintenance ... (2 Replies)
Discussion started by: aahlrich
2 Replies

5. Shell Programming and Scripting

Awk: Combine multiple lines based on number of fields

If a file has following kind of data, comma delimited 1,2,3,4 1 1 1,2,3,4 1,2 2 2,3,4 My required output must have only 4 columns with comma delimited 1,2,3,4 111,2,3,4 1,222,3,4 I have tried many awk command using ORS="" but couldnt progress (10 Replies)
Discussion started by: mdkm
10 Replies

6. UNIX for Dummies Questions & Answers

Need to combine two lines in a file based on first character of each line in a file

Hi, I have a requirement where I need to combine two lines in a file based on first character of each line in a file. Please find the sample content of the file below: Code: _______________________ 5, jaya, male, 4-5-90, single smart 6, prakash, male, 5-4-84, married fair 7, raghavi,... (1 Reply)
Discussion started by: jayaP
1 Replies

7. UNIX for Advanced & Expert Users

Need to combine two lines in a file based on first character of each line in a file

Hi, I have a requirement where I need to combine two lines in a file based on first character of each line in a file. Please find the sample content of the file below: Code: _______________________ 5, jaya, male, 4-5-90, single smart 6, prakash, male, 5-4-84, married fair 7, raghavi,... (1 Reply)
Discussion started by: jayaP
1 Replies

8. Shell Programming and Scripting

awk to remove lines in file if specific field matches

I am trying to remove lines in the target.txt file if $5 before the - in that file matches sorted_list. I have tried grep and awk. Thank you :). grep grep -v -F -f targets.bed sort_list grep -vFf sort_list targets awk awk -F, ' > FILENAME == ARGV {to_remove=1; next} > ! ($5 in... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

awk joining multiple lines based on field count

Hi Folks, I have a file with fields as follows which has last field in multiple lines. I would like to combine a line which has three fields with single field line for as shown in expected output. Please help. INPUT hname01 windows appnamec1eda_p1, ... (5 Replies)
Discussion started by: shunya
5 Replies

10. Shell Programming and Scripting

Update a specific field in file with Variable value based on other Key Word

I have an input file with A=xyz B=pqr I would want the value in Second Field (xyz or pqr) updated with a value present in Shell Variable based on the value passed in the first field. (A or B ) while read line do NEW_VALUE = `some functionality done on $line` If $line=First Field-... (1 Reply)
Discussion started by: infernalhell
1 Replies
ABCMATCH(1)						      General Commands Manual						       ABCMATCH(1)

NAME
abcmatch - search sequences of notes in an ABC file SYNOPSIS
abcmatch data-file [number] [-a] [-br d] [-c] [-con] [-ign] [-length_hist] [-pitch_hist] [-qnt] [-r n] [-v] [-ver] DESCRIPTION
abcmatch searches an ABC file containing (potentially) many tunes for specific sequences of notes. For example, if you know a few bars of a tune, you can use this program to find the tune having this sequence and perhaps identify the tune. At a minimum, abcmatch requires two files. A template file called match.abc which contains the bars that you are searching for and a large file consisting of a hundred or more ABC tunes. The program automatically loads up the match.abc file and then scans every tune in the large file. Though the program can be run stand-alone, it is really meant to be run with a GUI such as runabc.tcl (which is not yet part of Debian). Most of its output is rather cryptic. THE MATCHING PROCESS
The template file must be a well-formed ABC file containing the basic X:, M:, L:, and K: headers as well as the bars to be matched. (Nor- mally, this file is created by runabc.tcl.) It is important to finish each bar in the match file with a vertical line. abcmatch uses the key signature to figure out the relative position of the notes in the scale, and to determine all the assumed sharps and flats. Therefore the program can find matching bars in a tune that has been transposed to another key, as long as the key difference is not too large. Matches are output in a list format looking like 29 30 4 30 31 4 Each line indicates a particular match found by the program. The first number on each line gives the relative position of the tune in the data-file, while the next number gives the X: number of that tune. The last number is the bar number of the matching tune. Bar numbers are counted sequentially from the start of the tune, and all V: and P: indications are ignored. That is, the bar number returned by abcmatch may not match bar numbers printed by one of the PostScript-producing ABC processors such as abcm2ps or abcmidi-yaps. For the purposes of matching, abcmatch ignores all guitar chords, lyrics, note decorations (e.g., staccato markings), grace notes, etc. In chords such as [G2c2], only the highest note is considered. Any warnings or error messages from the ABC parser are suppressed unless the -c option is given. OPTIONS
-a Report any matching bars. By default, if the template file contains a sequence of several bars, the program will try to find places in the data file where the whole sequence matches. With this option, it returns all places in the data file where any of the bars in the template file match. -br d `Brief mode' is designed to identify groups of tunes sharing common bars. In this mode, the program determines the number of all bars in each tune from the data file which are also present in the template file. If the number of common bars is greater than or equal to the value of the d parameter, the program reports the tune and the number of common bars. Currently there is no user con- trol of the matching criterion; the rhythm must match exactly, and the notes are transposed to suit the key signature. -c Display error and warning messages from the ABC parser (which are suppressed by default). -con Do a pitch contour match. In this case, the program uses the key signature only to indicate accidentals. The pitch contour is com- puted from the pitch difference (interval) between adjacent notes. That is, C2 DE, c2 de, and G2 AB all have the same pitch contour. -ign Ignore simple bars. -length_hist This does no matching at all but returns a histogram of the distribution of note lengths in the data file. The output looks like length histogram 12 100 24 20 36 6 48 2 72 4 where a quarter note is 24 units, an eight note 12 units, a dotted half note 72 units etc. -pitch_hist This does no matching at all but returns a histogram of the distribution of pitches in the data file. The output looks like pitch histogram 64 2 66 9 67 11 where the first number on each line is a MIDI note number and the second is a count of the number of times that note occurred. -qnt Do a quantized pitch contour match. This works as described above for the -con option, but will also quantize the intervals as fol- lows: Unison and semitone intervals are assigned value 0, major 2nds to major 3rds value 1, and a perfect 4th or greater value 2. Negative numbers are used for descending intervals. -r n Resolution for matching. If the n parameter is zero, a perfect match must be found, meaning that the lengths of each note in a bar must match exactly in order to be reported. The larger the value of n, the looser the match will be. Note lengths are converted into temporal units where a quarter note is normally assigned a value of 24 (therefore an eighth note has a value of 12, a sixteenth a value of 6, a half note a value of 48 etc.) If you specify a temporal resolution of 12, then the pitch values of the notes only need to match at the time units that are multiples of an eight note. This means that the program would match the two bars C2 D2 and C C D D, as well as C2 D2 and C/D/C/D/D2. By selecting a suitable value for n, you can search for matches only at the beginning of a mea- sure or at the beginning of each beat. -v Run verbosely. -ver Display the program's version number. LIMITATIONS
The program has some limitations. For example, the data file must contain bar lines, and tied notes cannot be longer than the equivalent of 8 quarter notes. A resolution (-r option) that is too small may cause some buffers to be exceeded. When there are differences of key signa- tures of more than 5 semitones, the program may transpose the notes in the wrong direction. Also, tunes with more than one key signature or time signature may not be processed correctly. SEE ALSO
abc2midi(1), midi2abc(1), mftext(1) AUTHOR
This manual page was written by Anselm Lingnau <lingnau@debian.org> for the GNU/Linux system. VERSION
This manual page describes abcmatch version 1.42 as of 21 December 2006. 24 August 2007 ABCMATCH(1)
All times are GMT -4. The time now is 06:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy