Sponsored Content
Top Forums Shell Programming and Scripting Insert new line based on numerical number of column Post 302378121 by Scott on Monday 7th of December 2009 03:01:28 AM
Old 12-07-2009
Or with awk:
Code:
awk '
   (NR > 2) && (X != $1) { print "" } { X = $1 } 1
' input_file > output_file

Number Position Range
1 Initial 50
1 Initial 50

2 Terminal 150
2 Terminal 20
2 Single 10

3 Single 20

4 Double 50

5 Initial 50
5 Initial 60

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert comma based on max number of column

Hi, I am new to unix shell shell scripting. I have a specific requirement where I need to append comma's based on the max number of column in the file. Eg: If my source file look something like this, sengwa,china tom,america,northamerica smith,america walter My output file... (8 Replies)
Discussion started by: nicholas_ejn
8 Replies

2. Shell Programming and Scripting

Insert text at line number

I wrote a script to grep for a closing XML node. Then I need it to navigate up a line and insert some XML. Then go to the next occurrance. I have this INSERT_NODE='<QUANTITATIVE NAME="'${QR_NAME}'" QUANT="1" />' GREP_FOR='</JOB>' TMP_FILE=/tmp/lineArray.$$ if ]; then continue else ... (7 Replies)
Discussion started by: J-Man
7 Replies

3. UNIX for Dummies Questions & Answers

How to sort a column based on numerical ascending order if it includes e-10?

I have a column of numbers in the following format: 1.722e-05 2.018e-05 2.548e-05 2.747e-05 7.897e-05 4.016e-05 4.613e-05 4.613e-05 5.151e-05 5.151e-05 5.151e-05 6.1e-05 6.254e-05 7.04e-05 7.12e-05 7.12e-05 (6 Replies)
Discussion started by: evelibertine
6 Replies

4. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on numerical values of a column

I have a text file where the second column is a list of numbers going from small to large. I want to extract the rows where the second column is smaller than or equal to 0.0001. My input: rs10082730 9e-08 12 46002702 rs2544081 1e-07 12 46015487 rs1425136 1e-06 7 35396742 rs2712590... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. Shell Programming and Scripting

Insert data in first column(if blank) from previous line first column

Dear Team I need to insert field(which is need to taken from previous line's first field) in first column if its blank. I had tried using sed but not find the way. Detail input and output file as below. Kindly help for same. INPUT: SCGR SC DEV DEV1 NUMDEV DCP ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

6. Shell Programming and Scripting

Insert Columns before the last Column based on the Count of Delimiters

Hi, I have a requirement where in I need to insert delimiters before the last column of the total delimiters is less than a specified number. Say if the delimiters is less than 139, I need to insert 2 columns ( with blanks) before the last field awk -F 'Ç' '{ if (NF-1 < 139)} END { "Insert 2... (5 Replies)
Discussion started by: arunkesi
5 Replies

7. Shell Programming and Scripting

Insert a new column with sequence number (Delimiter as comma)

Hi All, I have a file which has data like a,b c,d e,f g,h And I need to insert a new column at the begining with sequence no( 1 to n) 1,a,b 2,c,d 3,e,f 4,g,h Please let me know how to acheive this in unix (3 Replies)
Discussion started by: weknowd
3 Replies

8. Shell Programming and Scripting

Insert value of column based on file name matching

At the top of the XYZ file, I need to insert the ABC data value of column 2 only when ABC column 1 matches the prefix XYZ file name (not the ".txt"). Is there an awk solution for this? ABC Data 0101 0.54 0102 0.48 0103 1.63 XYZ File Name 0101.txt 0102.txt 0103.txt ... (7 Replies)
Discussion started by: ncwxpanther
7 Replies

9. Shell Programming and Scripting

Insert line based on found string

Hi All I'm trying to insert a new line at the before each comment line in a file. Comment lines start with '#-----' there are other comments with in lines but I don't want a new line there. Example file: blah blah #do not insert here #this is a comment blah #some more #another comment... (10 Replies)
Discussion started by: Mudshark
10 Replies
PLSTRIPC(3plplot)						    PLplot API							 PLSTRIPC(3plplot)

NAME
plstripc - Create a 4-pen stripchart SYNOPSIS
plstripc(id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, styline, legline[], labx, laby, labtop) DESCRIPTION
Create a 4-pen stripchart, to be used afterwards by plstripa(3plplot) Redacted form: General: plstripc(id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, sty- line, legline, labx, laby, labz) Perl/PDL: plstripc(xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, sty- line, id, xspec, ypsec, legline, labx, laby, labtop) This function is used in example 17. ARGUMENTS
id (PLINT *, output) Identification number of stripchart to use on plstripa(3plplot) and plstripd(3plplot). xspec (char *, input) X-axis specification as in plbox(3plplot). yspec (char *, input) Y-axis specification as in plbox(3plplot). xmin (PLFLT, input) Initial coordinates of plot box; they will change as data are added. xmax (PLFLT, input) Initial coordinates of plot box; they will change as data are added. xjump (PLFLT, input) When x attains xmax, the length of the plot is multiplied by the factor (1 + xjump). ymin (PLFLT, input) Initial coordinates of plot box; they will change as data are added. ymax (PLFLT, input) Initial coordinates of plot box; they will change as data are added. xlpos (PLFLT, input) X legend box position (range from 0 to 1). ylpos (PLFLT, input) Y legend box position (range from 0 to 1). y_ascl (PLBOOL, input) Autoscale y between x jumps if y_ascl is true, otherwise not. acc (PLBOOL, input) Accumulate strip plot if acc is true, otherwise slide display. colbox (PLINT, input) Plot box color index (cmap0). collab (PLINT, input) Legend color index (cmap0). colline (PLINT *, input) Pointer to array with color indices (cmap0) for the 4 pens. styline (PLINT *, input) Pointer to array with line styles for the 4 pens. legline (char **, input) Pointer to character array containing legends for the 4 pens. labx (char *, input) X-axis label. laby (char *, input) Y-axis label. labtop (char *, input) Plot title. AUTHORS
Geoffrey Furnish and Maurice LeBrun wrote and maintain PLplot. This man page was automatically generated from the DocBook source of the PLplot documentation, maintained by Alan W. Irwin and Rafael Laboissiere. SEE ALSO
PLplot documentation at http://plplot.sourceforge.net/resources. August, 2012 PLSTRIPC(3plplot)
All times are GMT -4. The time now is 06:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy