Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Reducing input file size after pattern search Post 302996290 by Don Cragun on Sunday 23rd of April 2017 06:05:31 PM
Old 04-23-2017
With the code RudiC suggested, RS is already set to the default <newline> character.

Are there any @ characters in your input file other than the 1st character of each (multi-line) record?

Could the strings that you are searching for appear on any line other than the 2nd line in a record?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search file for pattern and grab some lines before pattern

I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in) This is on solaris Can you help? (2 Replies)
Discussion started by: frustrated1
2 Replies

2. Programming

reducing size of executeable in C under Unix

Hi, Could any one tell me how to reduce the size of an executable file of C under Unix. thanks (2 Replies)
Discussion started by: useless79
2 Replies

3. Solaris

reducing to root file size

My root file size has reached 80% and I am looking where all i can reduce the file size . Here is the output of top directories in / . To me none of this looks useful but not sure . We use an appplication and email. Which all can be deleted . Please advise . 2016989 989445 /var 930059 ... (2 Replies)
Discussion started by: Hitesh Shah
2 Replies

4. Shell Programming and Scripting

How to assign the Pattern Search string as Input Variable

guys, I need to know how to assing pattern matched string as an input command variable. Here it goes' My script is something like this. ./routing.sh <Server> <enable|disable> ## This Script takes an input <Server> variable from this line of the script ## echo $1 | egrep... (1 Reply)
Discussion started by: raghunsi
1 Replies

5. Shell Programming and Scripting

Search for a pattern in a String file and count the occurance of each pattern

I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported Input file is a free flowing file without any format example of output ERR-00001=5 .... ERR-01010=10 ..... ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies

6. Shell Programming and Scripting

How to use sed to search a particular pattern in a file backward after a pattern is matched.?

Hi, I have two files file1.txt and file2.txt. Please see the attachments. In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies

7. Shell Programming and Scripting

Reducing the decimal points of numbers (3d coordinates) in a file; how to input data to e.g. Python

I have a file full of coordinates of the form: 37.68899917602539 58.07500076293945 57.79100036621094 The numbers don't always have the same number of decimal points. I need to reduce the decimal points of all the numbers (there are 128 rows of 3 numbers) to 2. I have tried to do this... (2 Replies)
Discussion started by: crunchgargoyle
2 Replies

8. Shell Programming and Scripting

Search pattern in a file taking input from another file

Hi, Below is my requirement File1: svasjsdhvassdvasdhhgvasddhvasdhasdjhvasdjsahvasdjvdasjdvvsadjhv vdjvsdjasvdasdjbasdjbasdjhasbdasjhdbjheasbdasjdsajhbjasbjasbhddjb svfsdhgvfdshgvfsdhfvsdadhfvsajhvasjdhvsajhdvsadjvhasjhdvjhsadjahs File2: sdh hgv I need a command such that... (8 Replies)
Discussion started by: imrandec85
8 Replies

9. Shell Programming and Scripting

Grep command to search pattern corresponding to input from user

One more question: I want to grep "COS_12_TM_4 pattern from a file look likes : "COS_12_TM_4" " ];I am taking scan_out as the input from the user. How to search "COS_12_TM_4" in the file which is corresponds to scan_out (12 Replies)
Discussion started by: Preeti Chandra
12 Replies

10. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
RLAM(1) 						      General Commands Manual							   RLAM(1)

NAME
rlam - laminate records from multiple files SYNOPSIS
rlam [ -tS ][ -u ][ -iaN | -ifN | -idN | -iiN | -iwN | -ibN ] input1 input2 .. DESCRIPTION
Rlam simply joins records (or lines) from multiple inputs, separating them with the given string (TAB by default). Different separators may be given for different files by specifying additional -t options in between each file name. Note that there is no space between this option and its argument. If none of the input files uses an ASCII separator, then no end-of-line character will be printed, either. An input is either a stream or a command. Commands are given in quotes, and begin with an exclamantion point ('!'). If the inputs do not have the same number of lines, then shorter files will stop contributing to the output as they run out. The -ia option may be used to specify ASCII input (the default), or the -if option may be used to indicated binary IEEE 32-bit floats on input. Similarly, the -id and -ii options may be used to indicate binary 64-bit doubles or integer words, respectively. The -iw option specifies 2-byte short words, and the -ib option specifies bytes. If a number is immediately follows any of these options, then it indi- cates that multiple such values are expected for each record. For example, -if3 indicates three floats per input record for the next named input. In the case of the -ia option, no number indicates one line per input record, and numbers greater than zero indicate that many characters exactly per record. For binary input formts, no number implies one value per record. For anything other than EOL-separated input, the default tab separator is reset to the empty string. A hyphen ('-') by itself can be used to indicate the standard input, and may appear multiple times. The -u option forces output after each record (i.e., one run through inputs). EXAMPLE
To join files output1 and output2, separated by a comma: rlam -t, output1 output2 To join a file with line numbers (starting at 0) and its reverse: cnt `wc -l < lam.c` | rlam - -t: lam.c -t '!tail -r lam.c' To join four data files, each having three doubles per record: rlam -id3 file1.dbl file2.dbl file3.dbl file4.dbl > combined.dbl AUTHOR
Greg Ward SEE ALSO
cnt(1), histo(1), neaten(1), rcalc(1), tabfunc(1), total(1) RADIANCE
7/8/97 RLAM(1)
All times are GMT -4. The time now is 12:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy