Sponsored Content
Top Forums Shell Programming and Scripting Generate Codes based on start and End values of numbers in a column Post 302617281 by CarloM on Monday 2nd of April 2012 11:08:49 AM
Old 04-02-2012
Something like:
Code:
awk '
x!=$1 {first=1; print FS x FS 3}
x==$1 {print FS x FS (first?1:2); first=0}
{x=$1}
END {print x FS 3}
' file

(untested!)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pick values from column based on key values by usin AWK

Dear Guyz:) I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z). I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies

2. UNIX for Dummies Questions & Answers

Extract a specific number from an XML file based on the start and end tags

Hello People, I have the following contents in an XML file ........... ........... .......... ........... <Details = "Sample Details"> <Name>Bob</Name> <Age>34</Age> <Address>CA</Address> <ContactNumber>1234</ContactNumber> </Details> ........... ............. .............. (4 Replies)
Discussion started by: sushant172
4 Replies

3. UNIX Desktop Questions & Answers

Manipulating a list of numbers based on values

Hi, I have a single column of numbers from in tabulated text format ranging from 0 to 1. I want to manipulate the list of numbers so that if the number is greater than 0.5 (> 0.5), I get 1 - number. If the number is less than 0.5, the number is taken as it is and not altered. For example: ... (1 Reply)
Discussion started by: evelibertine
1 Replies

4. Shell Programming and Scripting

How to generate a csv files by separating the values from the input file based on position?

Hi All, I need help for doing the following. I have a input file like: aaaaaaaaaabbbbbbbbbbbbbbbbbbbb cccbbbbbaaaaaadddddaaaabbbbbbb now I am trying to generate a output csv file where i will have for e.g. 0-3 chars of each line as the first column in the csv, 4-10 chars of the line as... (3 Replies)
Discussion started by: babom
3 Replies

5. UNIX for Dummies Questions & Answers

extract regions of file based on start and end position

Hi, I have a file1 of many long sequences, each preceded by a unique header line. file2 is 3-columns list: headers name, start position, end position. I'd like to extract the sequence region of file1 specified in file2. Based on a post elsewhere, I found the code: awk... (2 Replies)
Discussion started by: pathunkathunk
2 Replies

6. Shell Programming and Scripting

Extract values from a specific column to the end

Hello friends, I have a text file with many columns (no. columns vary from row to row) separated by space. I need to collect all the values from 18th column to the end from each line and group them as pairs and then numbering like below.. 1. 18th-col-value 19th-col-value 2. 20th-col-value ... (5 Replies)
Discussion started by: prvnrk
5 Replies

7. Shell Programming and Scripting

Sum column values based in common identifier in 1st column.

Hi, I have a table to be imported for R as matrix or data.frame but I first need to edit it because I've got several lines with the same identifier (1st column), so I want to sum the each column (2nd -nth) of each identifier (1st column) The input is for example, after sorted: K00001 1 1 4 3... (8 Replies)
Discussion started by: sargotrons
8 Replies

8. Shell Programming and Scripting

Extracting values based on line-column numbers from multiple text files

Dear All, I have to solve the following problems with multiple tab-separated text file but I don't know how. Any help would be greatly appreciated. I have access to Linux mint (but not as a professional). I have multiple tab-delimited files with the following structure: file1: 1 44 2 ... (5 Replies)
Discussion started by: Bastami
5 Replies

9. UNIX for Beginners Questions & Answers

How do delete certain lines alone which are matching with start and end string values in file?

Hi, In my previous post ( How to print lines from a files with specific start and end patterns and pick only the last lines? ), i have got a help to get the last select statement from a file, now i need to remove/exclude the output from main file: Input File format: SELECT ABCD, DEFGH,... (2 Replies)
Discussion started by: nani2019
2 Replies

10. UNIX for Beginners Questions & Answers

Splitting week start date and end date based on custom period start dates

Below are my custom period start and end dates based on a calender, these dates are placed in a file, for each period i need to split into three weeks for each period row, example is given below. Could you please help out to achieve solution through shell script.. File content: ... (2 Replies)
Discussion started by: nani2019
2 Replies
TS_PACKET_INSERT(1)						   User Commands					       TS_PACKET_INSERT(1)

NAME
ts_packet_insert - insert packets into a Transport Stream DESCRIPTION
Usage: ts_packet_insert [switches] <infile> [switches] Insert TS packets into a Transport Stream at a positions specified by the user. Input: <infile> A H.222.0 TS stream. Switches: -p [positions] This a a colon (':') delimited string of numbers between 0 and 1, representing how far through to put each ts packet. E.g. -p 0.1:0.4:0.7:0.9 will insert 4 packets at 10%, 40%, 70% and 90% through the file. -pid [pid] The inserted packets will have the pid specfied. -s [string] The inserted packets will contain [string] as it's payload. -o [output file] The new TS file will be written out to the file specified. (defaults to out.ts) -h (--help) This message. Example: ts_packet_insert -p 0.3:0.6 -o out.ts -pid 89 -s "AD=start" in.ts ts_packet_insert [switches] <infile> [switches] Insert TS packets into a Transport Stream at a positions specified by the user. Input: <infile> A H.222.0 TS stream. Switches: -p [positions] This a a colon (':') delimited string of numbers between 0 and 1, representing how far through to put each ts packet. E.g. -p 0.1:0.4:0.7:0.9 will insert 4 packets at 10%, 40%, 70% and 90% through the file. -pid [pid] The inserted packets will have the pid specfied. -s [string] The inserted packets will contain [string] as it's payload. -o [output file] The new TS file will be written out to the file specified. (defaults to out.ts) -h (--help) This message. Example: ts_packet_insert -p 0.3:0.6 -o out.ts -pid 89 -s "AD=start" in.ts SEE ALSO
The full documentation for ts_packet_insert is maintained as a Texinfo manual. Please check http://tstools.berlios.de for more informa- tion. ts_packet_insert 1.11 November 2008 TS_PACKET_INSERT(1)
All times are GMT -4. The time now is 03:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy