Sponsored Content
Top Forums Shell Programming and Scripting Insert new line based on numerical number of column Post 302378117 by frans on Monday 7th of December 2009 02:44:46 AM
Old 12-07-2009
Bug

try this :
Code:
#!/bin/bash
NN=""
outputFile="/tmp/output"
while read N LINE
do
    [ "$NN" != "$N" ] && echo
    echo "$N $LINE"
    NN=$N
done < $inputfile > $outputfile

 

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
wxScrollBar(3erl)					     Erlang Module Definition						 wxScrollBar(3erl)

NAME
wxScrollBar - See external documentation: wxScrollBar. DESCRIPTION
See external documentation: wxScrollBar . This class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler DATA TYPES
wxScrollBar() : An object reference, The representation is internal and can be changed without notice. It can't be used for comparsion stored on disc or distributed for use on other nodes. EXPORTS
new() -> wxScrollBar() See external documentation . new(Parent::wxWindow() (see module wxWindow), Id::integer()) -> wxScrollBar() Equivalent to new(Parent, Id, []) . new(Parent::wxWindow() (see module wxWindow), Id::integer(), Options::[Option]) -> wxScrollBar() Types Option = {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} | {validator, wx() (see module wx)} See external documentation . create(This::wxScrollBar(), Parent::wxWindow() (see module wxWindow), Id::integer()) -> bool() Equivalent to create(This, Parent, Id, []) . create(This::wxScrollBar(), Parent::wxWindow() (see module wxWindow), Id::integer(), Options::[Option]) -> bool() Types Option = {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} | {validator, wx() (see module wx)} See external documentation . getRange(This::wxScrollBar()) -> integer() See external documentation . getPageSize(This::wxScrollBar()) -> integer() See external documentation . getThumbPosition(This::wxScrollBar()) -> integer() See external documentation . getThumbSize(This::wxScrollBar()) -> integer() See external documentation . setThumbPosition(This::wxScrollBar(), ViewStart::integer()) -> ok See external documentation . setScrollbar(This::wxScrollBar(), Position::integer(), ThumbSize::integer(), Range::integer(), PageSize::integer()) -> ok Equivalent to setScrollbar(This, Position, ThumbSize, Range, PageSize, []) . setScrollbar(This::wxScrollBar(), Position::integer(), ThumbSize::integer(), Range::integer(), PageSize::integer(), Options::[Option]) -> ok Types Option = {refresh, bool()} See external documentation . destroy(This::wxScrollBar()) -> ok Destroys this object, do not use object again AUTHORS
<> wxErlang 0.98.9 wxScrollBar(3erl)
All times are GMT -4. The time now is 12:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy