Sponsored Content
Top Forums Shell Programming and Scripting Merging dupes on different lines in a dictionary Post 302698315 by Chubler_XL on Sunday 9th of September 2012 10:42:21 PM
Old 09-09-2012
Here is an awk script:

Code:
awk -F= '
{ k=$1
  for(i=1;i<=NF;i++)
     if($i in same) k=same[$i];
  for(i=1;i<=NF;i++)
     same[$i]=k;
}
END {
   for(i in same)
      keys[same[i]]=keys[same[i]] "=" i;
   for(k in keys)
      print substr(keys[k],2);
}' infile

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Merging lines into one

Hello. I would be very pleased if sb. help me to solve my problem. I've got a file with many non blank lines and I want to merge all lines into one not destroy the informations on them. I've tryed it with split and paste, tr, sed , but everything I've done has been wrong. I know about crazy... (8 Replies)
Discussion started by: Foxgard
8 Replies

2. Shell Programming and Scripting

Merging lines using AWK

Hi, Anybody help on this. :( I want to merge the line with previous line, if the line starts with 7. Otherwise No change in the line. Example file aa.txt is like below 122122 222222 333333 734834 702923 389898 790909 712345 999999 My output should be written in another file... (6 Replies)
Discussion started by: senthil_is
6 Replies

3. Shell Programming and Scripting

Conditional merging of lines

I have a large file where some lines have been split into two lines; some of them even with white spaces before the second line. e.g in the following text I want to merge only specific lines ( say UNIX is cool), also removing white spaces only between them, others shall remain same on the output.... (4 Replies)
Discussion started by: sunny23
4 Replies

4. Shell Programming and Scripting

Merging lines

Hi folks. Could somebody help me write a script or command that will look through a file and for every line that doesn't contain a certain value, merge it with the one above? For example, the file contains: SCOTLAND|123|ABC|yes SCOTLAND|456|DEF|yes SCOTLAND|78 9|GHI|yes ... (3 Replies)
Discussion started by: MDM
3 Replies

5. Shell Programming and Scripting

merging two .txt files by alternating x lines from file 1 and y lines from file2

Hi everyone, I have two files (A and B) and want to combine them to one by always taking 10 rows from file A and subsequently 6 lines from file B. This process shall be repeated 40 times (file A = 400 lines; file B = 240 lines). Does anybody have an idea how to do that using perl, awk or sed?... (6 Replies)
Discussion started by: ink_LE
6 Replies

6. Shell Programming and Scripting

Merging lines

Thanks it worked for me. I have one more question on top of that. We had few records which were splitted in 2 lines instead of one. Now i identified those lines. The file is too big to open via vi and edit it. How can i do it without opening the file. Suppose, I want line number 1001 & 1002 to... (2 Replies)
Discussion started by: Gangadhar Reddy
2 Replies

7. Shell Programming and Scripting

Removing dupes within 2 delimited areas in a large dictionary file

Hello, I have a very large dictionary file which is in text format and which contains a large number of sub-sections. Each sub-section starts with the following header : #DATA #VALID 1 and ends with a footer as shown below #END The data between the Header and the Footer consists of... (6 Replies)
Discussion started by: gimley
6 Replies

8. Shell Programming and Scripting

Merging 2 lines together

I have a small problem, which due to my lack of knowledge, has left me unable to decipher some of the solutions that I looked at on these forums. So below is a piece of text, which I ran via cat -vet, which comes from within a program file. I have many such programs to process and repeatable,... (4 Replies)
Discussion started by: skarnm
4 Replies

9. Shell Programming and Scripting

Merging multiple lines to columns with awk, while inserting commas for missing lines

Hello all, I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person. In the csv, a person may be listed from one to four times... (9 Replies)
Discussion started by: RalphNY
9 Replies

10. UNIX for Beginners Questions & Answers

Merging two lines into one (awk)

Hi, I am attempting to merge the following lines which run over two lines using awk. INITIAL OUTPUT 2019 Sep 28 10:47:24.695 hkaet9612 last message repeated 1 time 2019 Sep 28 10:47:24.695 hkaet9612 %ETHPORT-5-IF_DOWN_INTERFACE_REMOVED: Interfa ce Ethernet1/45 is down (Interface removed)... (10 Replies)
Discussion started by: sand1234
10 Replies
ESPEAK(1)						      General Commands Manual							 ESPEAK(1)

NAME
espeak - A multi-lingual software speech synthesizer. SYNOPSIS
espeak [options] [<words>] DESCRIPTION
espeak is a software speech synthesizer for English, and some other languages. OPTIONS
-h Show summary of options. -f <text file> Text file to speak --stdin Read text input from stdin instead of a file If neither -f nor --stdin, <words> are spoken, or if none then text is spoken from stdin, each line separately. -q Quiet, don't produce any speech (may be useful with -x) -a <integer> Amplitude, 0 to 20, default is 10 -l <integer> Line length. If not zero (which is the default), consider lines less than this length as and-of-clause -p <integer> Pitch adjustment, 0 to 99, default is 50 -s <integer> Speed in words per minute, default is 160 -v <voice name> Use voice file of this name from espeak-data/voices -b Input text is 8-bit encoding -m Indicates that the text contains SSML (Speech Synthesis Markup Language) tags or other XML tags. Those SSML tags which are supported are interpreted. Other tags, including HTML, are ignored, except that some HTML tags such as <hr> <h2> and <li> ensure a break in the speech. -w <wave file name> Write output to this WAV file, rather than speaking it directly -x Write phoneme mnemonics to stdout -X Write phonemes mnemonics and translation trace to stdout. If rules files have been built with --compile=debug, line numbers will also be displayed. --stdout Write speech output to stdout --compile=<voice name> Compile the pronunciation rules and dictionary in the current directory. =<voice name> is optional and specifies which language --path=<path> Specifies the directory containing the espeak-data directory --phonout=<filename> Write output from -x -X commands and mbrola phoneme data to this file --punct="<characters>" Speak the names of punctuation characters during speaking. If =<characters> is omitted, all punctuation is spoken. -k <integer> Indicate capital letters with: 1=sound, 2=the word "capitals", higher values = a pitch increase (try -k20). --voices[=<language code>] Lists the available voices. If =<language code> is present then only those voices which are suitable for that language are listed. --compile=voicename Compile the pronunciation rules and dictionary in the current directory. =<voice name> is optional and specifies which language --compile=debug Compile the pronunciation rules and dictionary in the current directory as above, but include line numbers, that get shown when -X is used. AUTHOR
eSpeak was written by Jonathan Duddington <jonsd@jsd.clara.co.uk>. The webpage for this package can be found at http://espeak.source- forge.net/. This manual page was written by Luke Yelavich <themuso@ubuntu.com>, for the Ubuntu project (but may be used by others). July 25, 2007 ESPEAK(1)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy