Pairing the nth elements on multiple lines iteratively
Hello,
I'm trying to create a word translation section of a book. Each entry in the word list will come from a set of linguistically analyzed texts.
Each sentence in the text has the following format. The first element in each line is the "name" of the line (i.e. "A","B","C","D"). The first line is the object language, the second line is a morpheme gloss, the third and fourth lines are stem/word-level translations:
What I'd like to do is pull the nth element in 2 or more lines (not counting the line "name"), and output them as a pair (or n-tuple) on the same line, later to be exported as columns to a spreadsheet. So for the above, I'd like:
Note that the initial "name" elements occur several thousand times in the file, and I'd like to take care of all lines so named at the same time. Thanks, any ideas?
Last edited by John Lyon; 08-01-2015 at 02:19 PM..
Reason: adding more info
Hi,
I got a lot of files looking like this:
1
0.5
6
All together there are ard 1'000'000 lines in each of the ard 100 files.
I want to build the average for every line, and write the result to a new file.
The averaging should start at a specific line, here for example at line... (10 Replies)
Hi all,
I would like to extract the line number of the n-th occurrency of a given string in a file.
e.g.
xxx
yyy
xxx
zzz
xxx
the second occurrency of xxx is at line 3.
What is the fastest way to do it in bash?
Thank you, (8 Replies)
I have several files (around 50) that have the similar format. I need to extract the 5th line from every file and output that into a text file. So far, I have been able to figure out how to do it for a single file:
$ awk 'NR==5' text1.txt > results.txt
OR
$ sed -n '5p' text1.txt > results.txt... (6 Replies)
This code works perfect when using a machine with only one interface online. (Excluding the loopback of course) But when I have other interface up for vmware or a vpn the output gets mixed up. I know I had this working when I was just reading ip's from files so I know it is not a problem with... (8 Replies)
Greetings experts. Searched the forums (perhaps not hard enough?) - Am searching for a method to capture all output from a log file following the nth occurrence of a known string.
Background:
Using bash, I want to monitor my Oracle DB alert log file. The script will count the total # of... (2 Replies)
Hi all,
Here is my problem for which i am breaking my head for past three days..
I have parted command output as follows..
Model: ATA WDC WD5000AAKS-0 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type ... (3 Replies)
Hi,
I want to rename several files like this:
example:
A0805120817.BHN
A0805120818.BHN
.....
to:
20120817.0805.N
20120818.0805.N
......
How can i do this via terminal or in shell bash script ?
thanks, (6 Replies)
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Hi,
I have a huge list of archives (.gz). Each archive is about 40MB. A file is generated every minute so if I want to analyze the data for 1 hour I get already 60 files for example.
These are text files, ';' separated, each line having about 300 fields (columns).
What I need to do is to... (11 Replies)
I need your help to discover missing elements for each box.
In theory each box should have 4 items: ITEM01, ITEM02, ITEM08, and ITEM10.
Some boxes either have a missing item (BOX02 ITEM08) or might have da duplicate item (BOX03 ITEM02) and missing another one (BOX03 ITEM01).
file01.txt
... (2 Replies)
Discussion started by: alex2005
2 Replies
LEARN ABOUT HPUX
tt_message_abstainer
tt_message_abstainer(library call) tt_message_abstainer(library call)
NAME
tt_message_abstainer -- return offer's nth abstaining procid
SYNOPSIS
#include <Tt/tt_c.h>
char *tt_message_abstainer(
Tt_message m,
int n);
DESCRIPTION
The tt_message_abstainer function returns the procid of the nth abstainer of the specified message.
The m argument is the opaque handle for the message involved in this operation. The n argument is the number of the abstainer to be
returned. The first abstainer is numbered zero.
RETURN VALUE
Upon successful completion, the tt_message_abstainer function returns the procid of the nth abstainer. The application can use
tt_ptr_error to extract one of the following Tt_status values from the returned pointer:
TT_OK The operation completed successfully.
TT_ERR_PROCID
There is no valid default procid, perhaps because tt_open has not yet been called.
TT_ERR_NUM
The integer value passed was invalid (out of range).
TT_ERR_STATE
The specified message is not in state TT_RETURNED. Since only TT_OFFERs can be in state TT_RETURNED, this status will be
returned if the specified message is a TT_NOTICE or a TT_REQUEST.
TT_ERR_POINTER
The pointer passed does not point to an object of the correct type for this operation.
APPLICATION USAGE
The application can use tt_free to free any data stored in the address returned by the ToolTalk API.
SEE ALSO
Tt/tt_c.h - Tttt_c(5), tt_message_abstainers_count(3), tt_ptr_error(3), tt_free(3).
tt_message_abstainer(library call)