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
XmForm(3X)																XmForm(3X)

NAME
XmTree - The Tree widget class SYNOPSIS
#include <Xm/XTree.h> DESCRIPTION
The Tree widget is a container that shows the relationship of its children in a graphical tree-like format. Each child of the Tree widget is a node in the Tree. The parent-child relationships between these nodes are completely distinct from the widget hierarch.. The hierarchy of nodes is created by specifying the tree "parent" of each node as a constraint resource. If a node's parent is NULL then it is assumed to be a root of the tree. Although each widget can only have one parent, the Tree widget supports adding more than one "root" node to a single Tree. Note: the Tree widget assumes that is will be totally responsible for mapping and unmapping its children. Therefore no child of this widget should ever modify its mappedWhenManaged resource. If a child does modify this resource the behavior is undefined. User Interaction Each node in the tree can be in four states: open, closed, always open, and hidden. The state of a node changes how it appears to the user and what actions are available to the user. Open This node will have an open folder shown to its left that may be selected by the user to close this node. When a node is open all of its children will be visible to the user. Closed This node will have a closed folder shown to its left that may be selected by the user to open this node. When a node is closed none of its children will be visible to the user. Always Open This node will have no folder button associated with it. All of its children will be visible to the user. Hidden This node will not be shown to the user and all of its children will appear and act exactly as if they were children of this node's parent. It will appear to the user as if this node does not exist. To maintain consistency of the user interface we have found that it is bestto use the node state "Always Open" for nodes with no children. This way the user will only see a folder button next to a node that has children to display. A folder button associated with a node that has no children has no defined semantics. Normal Resources Name Class Type Initial Value connectStyle ConnectStyle unsigned char XmTreeDirect horizontalNodeSpace Dimension HorizontalDimension 20 verticalNodeSpace Dimension VerticalDimension 2 All resource names begin with XmN and all resource class names begin with XmC. connectStyle The style of the lines visually connecting parent nodes to children nodes. The valid styles are XmTreeDirect or XmTreeLadder. horizontalNodeSpace verticalNodeSpace The amount of space between each node in the tree and it nearest neighbor. The following resources are inherited from the XmHierarchy widget: Name Class Type Initial Value autoClose AutoClose Boolean True closeFolderPixmap Pixmap Pixmap XmUNSPECIFIED_PIXMAP horizontalMargin Dimension HorizontalDimension 2 openFolderPixmap Pixmap Pixmap XmUNSPECIFIED_PIXMAP refigureMode Boolean Boolean True verticalMargin Dimension VerticalDimension 2 All resource names begin with XmN and all resource class names begin with XmC. Constraint Resources Name Class Type Initial Value openClosePadding OpenClosePadding Int 0 lineColor Foreground Pixel <dynamic> lineWidth LineWidth Dimension 0 All resource names begin with XmN and all resource class names begin with XmC. openClosePadding The number of pixels between the folder button and the node it is associated with. lineColor The color of the line connecting a node to its parent. The default value for this resource is the foreground color of the Tree widget. lineWidth The width of a connection line between a node and its parent The following constraint resources are inherited from the XmHierarchy widget: Name Class Type Initial Value insertBefore InsertBefore Widget NULL nodeState NodeState XmHierarchyNodeState Open parentNode ParentNode Widget NULL All resource names begin with XmN and all resource class names begin with XmC. Geometry Management: The layout is performed by assigning each node a box that is just large enough to con- tain itself and all of its children. A recursive layout is then performed that centers each node vertically in its box and at the extreme left horizontally. The children's boxes are then placed to the right of the node separated by the horizontalNodeSpace from their parent, stacked above each other and separated by verti- calNodeSpace. This process is repeated recursively for each child in the tree. The preferred size of the entire tree will be just large enough to contain all nodes in the hierarchy. As the state of nodes change the tree will attempt to resize itself to con- tain its current configuration. If the tree is forced larger than the desired size the nodes will be centered vertically and flush to the left edge of the tree widget. If the tree is forced smaller, some nodes may be moved or drawn outside the end of the tree. For this reason it is usually desirable to put the tree into a Scrolled Window widget. SEE ALSO
XmColumn(3X) COPYRIGHT
Copyright (c) 1992 by Integrated Computer Solutions, Inc. 15 July 1992 XmForm(3X)
All times are GMT -4. The time now is 10:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy