Sponsored Content
Top Forums Shell Programming and Scripting Inserting Lines between data sets using SED? Post 302137420 by summer_cherry on Tuesday 25th of September 2007 02:24:18 AM
Old 09-25-2007
Hope can help you

Hi,
I suppose your requirements is as follow:

INPUT:
Code:
123456789avadf
123456789iowqeuroi
123456780fdkljfdsa
123456789kljasdgl;kj
123456789nm,zxcvn

OUTPUT:
Code:
123456789avadf
123456789iowqeuroi

123456780fdkljfdsa

123456789kljasdgl;kj
123456789nm,zxcvn

CODE:
Code:
cat c | awk '{
if (pre=="")
{
	print $0
}
else
{
	if (substr($0,1,9)!=pre)
	{
		print ""
		print $0
	}
	else
	{
		print $0
	}
}
pre=substr($0,1,9)
}'

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading in data sets into arrays from an input file.

Hye all, I would like some help with reading in a file in which the data is seperated by commas. for instance: input.dat: 1,2,34,/test for the above case, the fn. will store the values into an array -> data as follows: data = 1 data = 2 data = 34 data = /test I am trying to write... (5 Replies)
Discussion started by: sidamin810
5 Replies

2. Virtualization and Cloud Computing

Clouds (Partially Order Sets) - Streams (Linearly Ordered Sets) - Part 2

timbass Sat, 28 Jul 2007 10:07:53 +0000 Originally posted in Yahoo! CEP-Interest Here is my follow-up note on posets (partially ordered sets) and tosets (totally or linearly ordered sets) as background set theory for event processing, and in particular CEP and ESP. In my last note, we... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. Shell Programming and Scripting

Finding Overlap between two sets of data

Hi everyone, I posted this earlier, but the idea changed since then and I figured it would make more sense if I repost with a clearer idea in hopes someone can help me out. I have two lists of data in file1 and file 2 file1 (tab separated - column1 column2 column 3) 1 91625106 ... (1 Reply)
Discussion started by: labrazil
1 Replies

4. Shell Programming and Scripting

How to extract specific data and count number containing sets from a file?

Hello everybody! I am quit new here and hope you can help me. Using an awk script I am trying to extract data from several files. The structure of the input files is as follows: TimeStep parameter1 parameter2 parameter3 parameter4 e.g. 1 X Y Z L 1 D H Z I 1 H Y E W 2 D H G F 2 R... (2 Replies)
Discussion started by: Daniel8472
2 Replies

5. Shell Programming and Scripting

BASH: Swap first two lines in sets of 4

Hi. I may have mentioned in the OP to this thread that the AHK macro script I was trying to sort was, relative to its full length, only partly in the right format to be sorted by the methods discussed in that thread. Now I'm looking to tackle the rest of the data in that AHK script. ... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

6. Shell Programming and Scripting

awk - sed :Help Getting next lines data .

Experts, Can you please help how to get the output that are written just below "bad" calls badcalls nullrecv 439486 54 0 badlen xdrcall dupchecks ... (6 Replies)
Discussion started by: rveri
6 Replies

7. UNIX for Dummies Questions & Answers

UNIX one line cmd join 2 sets of data from 2 files

Hi all, This is my first and undoubtedly many posts to come. I'm new to using unix and would like a hand with this problem I have. What i'm trying to do is match 2 sets of data from 2 files and put result into file 3. Sounds simply but there is a catch, the match is a "partial field" match, if... (2 Replies)
Discussion started by: tugar
2 Replies

8. 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
asa(1)							      General Commands Manual							    asa(1)

NAME
asa - interpret ASA carriage control characters SYNOPSIS
[files] DESCRIPTION
interprets the output of FORTRAN programs that utilize ASA carriage control characters. It processes either the files whose names are given as arguments, or the standard input if is specified or if no file names are given. The first character of each line is assumed to be a control character. The following control characters are interpreted as indicated: (blank) Output a single new-line character before printing. (space) (UNIX Standard only, see standards(5)) The rest of the line will be output without change. A <newline> shall be output, then the rest of the input line. Output a new-page character before printing. Overprint previous line. (UNIX Standard only, see standards(5)) The <newline> of the previous line shall be replaced with one or more implementation-defined characters that causes printing to return to column position 1, followed by the rest of the input line. If the + is the first character in the input, it shall have the same effect as <space>. Lines beginning with other than the above characters are treated the same as lines beginning with a blank. The first character of a line is printed. If any such lines appear, an appropriate diagnostic is sent to standard error. This program forces the first line of each input file to start on a new page. (UNIX Standard only, see standards(5)) The action of the asa utility is unspecified upon encountering any character other than those listed above as the first character in a line. To view the output of FORTRAN programs which use ASA carriage control characters and have them appear in normal form, can be used as a fil- ter: The output, properly formatted and paginated, is then directed to the line printer. FORTRAN output previously sent to a file can be viewed on a user terminal screen by using: EXTERNAL INFLUENCES
For information about the UNIX standard environment, see standards(5). Environment Variables determines the interpretation of text within file as single- and/or multi-byte characters. determines the language in which messages are displayed. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. SEE ALSO
efl(1), f77(1), ratfor(1), standards(5). STANDARDS CONFORMANCE
asa(1)
All times are GMT -4. The time now is 03:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy