Sponsored Content
Full Discussion: How to get next 4 lines
Top Forums Shell Programming and Scripting How to get next 4 lines Post 302223346 by Perderabo on Saturday 9th of August 2008 10:51:22 AM
Old 08-09-2008
Code:
$ yes junk | nl -s: | sed 15q > data
$ cat data
     1:junk
     2:junk
     3:junk
     4:junk
     5:junk
     6:junk
     7:junk
     8:junk
     9:junk
    10:junk
    11:junk
    12:junk
    13:junk
    14:junk
    15:junk
$ sed -n '/ 6:/{n;N;N;N;p;}' data
     7:junk
     8:junk
     9:junk
    10:junk
$

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count lines - ignoring blank lines and commented lines

What is the command to count lines in a files, but ignore blank lines and commented lines? I have a file with 4 sections in it, and I want each section to be counted, not including the blank lines and comments... and then totalled at the end. Here is an example of what I would like my... (6 Replies)
Discussion started by: kthatch
6 Replies

2. Shell Programming and Scripting

Perl XML, find matching condition and grep lines and put the lines somewhere else

Hi, my xml files looks something like this <Instance Name="New York"> <Description></Description> <Instance Name="A"> <Description></Description> <PropertyValue Key="false" Name="Building A" /> </Instance> <Instance Name="B"> ... (4 Replies)
Discussion started by: tententen
4 Replies

3. 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

4. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

5. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

6. UNIX for Advanced & Expert Users

SQL script with 86000 lines: new files with only 10000 lines (per file)

Hi this is my SQL script $ wc -l insert_into_customers.sql 85601 insert_into_customers.sqlI wish to cut this file into 9 files each 10000 lines (the last one less) $ wc -l insert_into_customers_00*.sql 10000 insert_into_customers_001.sql 10000 insert_into_customers_002.sql ... (1 Reply)
Discussion started by: slashdotweenie
1 Replies

7. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies

8. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 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

How to print lines from a files with specific start and end patterns and pick only the last lines?

Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" . I have attached sample input file and the desired input should be as: INPUT FORMAT: SELECT ABCD, DEFGH, DFGHJ, JKLMN, AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
TMX2TMX(1p)						User Contributed Perl Documentation					       TMX2TMX(1p)

NAME
tmx2tmx - utility to convert and filter TMX files SYNOPSYS
tmx2tmx -cat file1.tmx ... filen.tmx > file.tmx tmx2tmx -toTrados file1.tmx > file2.tmx tmx2tmx -clean file1.tmx > file2.tmx tmx2tmx -select=PT,EN multilingual.tmx > pt-en.tmx DESCRIPTION
This utility processes TMX documents and return TMX documents. Tasks done with this utility include conversion between TMX versions and TMX cleaning. TRADOS conversion As you maybe know, TRADOS is a company producing computer software for translators. It includes WorkBench which imports TMX files. Unfortunately, the version I used do not import TMX version 1.4. This process is done using the switch "-toTrados": tmx2tmx -toTrados file.tmx > trados.tmx TMX Cleaning Specially when translation memories are created from anotated text, or extracted directly from the Internet using any automatic method. This switch is used to remove junk in translation units. This option tries to remove junk from TMX files, like empty pairs where one of the sides is empty, or removing other junk type. Use it this way: tmx2tmx -clean file.tmx > file2.tmx Concatenating TMX tmx2tmx -cat file1.tmx ... filen.tmx > file.tmx ls | grep '.tmx$' | tmx2tmx -cat > file.tmx Select languages Select a bunch of languages: tmx2tmx -select=PT,EN,FR huge.tmx > pt-en-fr.tmx SEE ALSO
tmx2html, po2tmx, XML::TMX AUTHOR
Alberto Simo~es, <albie@alfarrabio.di.uminho.pt> COPYRIGHT AND LICENSE
Copyright 2004 by Projecto Natura This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-05 TMX2TMX(1p)
All times are GMT -4. The time now is 03:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy