Sponsored Content
Full Discussion: Adding number in one column
Top Forums Shell Programming and Scripting Adding number in one column Post 302968973 by rdrtx1 on Wednesday 16th of March 2016 03:06:18 PM
Old 03-16-2016
csh example:
Code:
#!/bin/csh

set i=2
set lines="`cat 1.dat`"
while ( $i <= 100 )
   rm -f $i.dat
   set l=1
   while ( $l <= $#lines )
      set arr = ( $lines[$l] )
      @ arr[2] = $arr[2] + $i - 1
      echo $arr[1] $arr[2] >> $i.dat
      @ l = $l + 1
   end
   @ i = $i + 1
end

This User Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding a columnfrom a specifit line number to a specific line number

Hi, I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers. To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
Discussion started by: Ezy
2 Replies

2. UNIX for Dummies Questions & Answers

Adding a column with the row number using awk

Is there anyway to use awk to add a first column to my data that automatically goes from 1 to n , where n is the numbers of my rows?:confused: (4 Replies)
Discussion started by: cosmologist
4 Replies

3. Shell Programming and Scripting

Rename a header column by adding another column entry to the header column name URGENT!!

Hi All, I have a file example.csv which looks like this GrpID,TargetID,Signal,Avg_Num CSCH74_1_1,2007,61,256 CSCH74_1_1,212007,647,679 CSCH74_1_1,12007,3,32 CSCH74_1_1,207,299,777 I want the output as GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num CSCH74_1_1,2007,61,256... (4 Replies)
Discussion started by: Vavad
4 Replies

4. UNIX for Dummies Questions & Answers

Rename a header column by adding another column entry to the header column name

Hi All, I have a file example.csv which looks like this GrpID,TargetID,Signal,Avg_Num CSCH74_1_1,2007,61,256 CSCH74_1_1,212007,647,679 CSCH74_1_1,12007,3,32 CSCH74_1_1,207,299,777 I want the output as GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num CSCH74_1_1,2007,61,256... (1 Reply)
Discussion started by: Vavad
1 Replies

5. Shell Programming and Scripting

Taking largest (negative) number from column of coordinates and adding positive form to every other

Hello all, I'm new to the forums and hope to be able to contribute something useful in the future; however I must admit that what has prompted me to join is the fact that currently I need help with something that has me at the end of my tether. I have a PDB (Protein Data Bank) file which I... (13 Replies)
Discussion started by: crunchgargoyle
13 Replies

6. Shell Programming and Scripting

Adding a new column as sequential number but with a little complication

I am a newbie to shell programming and maybe somebody can help me out a little. Here's my problem: I got a PIPE delimited file with header record. I need to add a new column name as RECORDKEY. I would like to use a counter to generate this new value for each record. I plan to do a while loop and... (4 Replies)
Discussion started by: johnhips
4 Replies

7. Shell Programming and Scripting

Adding values of a column based on another column

Hello, I have a data such as this: ENSGALG00000000189 329 G A 4 2 0 ENSGALG00000000189 518 T C 5 1 0 ENSGALG00000000189 1104 G A 5 1 0 ENSGALG00000000187 3687 G T 5 1 0 ENSGALG00000000187 4533 A T 4 2 0 ENSGALG00000000233 5811 T C 4 2 0 ENSGALG00000000233 5998 C A 5 1 0 I want to... (3 Replies)
Discussion started by: Homa
3 Replies

8. Shell Programming and Scripting

Help with compare two column and print out column with smallest number

Input file : 5 20 500 2 20 41 41 0 23 1 Desired output : 5 2 20 0 1 By comparing column 1 and 2 in each line, I hope can print out the column with smallest number. I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies

9. Shell Programming and Scripting

Split column data if the table has n number of column's

please write a shell script Table -------------------------- 1 2 3 a b c 3 4 5 c d e 7 8 9 f g h Output should be like this --------------- 1 2 3 3 4 5 7 8 9 a b c c d e f g h (1 Reply)
Discussion started by: Priti2277
1 Replies

10. Shell Programming and Scripting

Split column data if the table has n number of column's with some record

Split column data if the table has n number of column's with some record then how to split n number of colmn's line by line with records Table --------- Col1 col2 col3 col4 ....................col20 1 2 3 4 .................... 20 a b c d .................... v ... (11 Replies)
Discussion started by: Priti2277
11 Replies
kst(1)								       kst2								    kst(1)

NAME
kst -- plots scientific data SYNOPSIS
kst kst [ -F DATASOURCE ] [ -f STARTFRAME ] [ -n NUMFRAMES ] [ -s FRAMESPERSAMPLE [ -a ] ] kstfile kst datasource [ -f STARTFRAME ] [ -n NUMFRAMES ] [ -s FRAMESPERSAMPLE [ -a ] ] [ -P PLOTNAME ] [ -A] [ -d ] [ -l ] [ -b ] [ -x FIELD ] [ -e FIELD ] [ -r RATE ] [ -y FIELD ] [ -p FIELD ] [ -h FIELD ] [ -z FIELD ] [ --png filename ] [ --print filename [ --landscape | --portrait ] [ --Letter | --A4 ] ] DESCRIPTION
kst is a graphical data plotting tool, which includes the ability to plot live data (contiuously update the plot as new data becomes avail- able). kst may be run entirely from within its GUI, in which case no command line arguments are needed. kst has a powerful wizard for easily set- ting up new plots. In the second invocation, kst loads pre-saved plot specifications from the file kstfile and optionally may override some of the settings in that file. In the third invocation, kst displays plots of the data as directed in the default manner. Additional datasources may be specified on the command line with options for that datasource following it. Command line options generally apply to all subsequent options unless later overridden. OPTIONS
-A plot all curves in separate plots -a average frames (simple mean) when plotting with -s. --A4 use A4 sized paper for printing. Requires --print. -b plot as bargraphs. -d use points when plotting curves. -e FIELD use FIELD as the magnitude of error bars applied to the next plot. -F datasource override the datasource indicated in the kstfile and instead use datasource. -f STARTFRAME begin plotting at STARTFRAME frames into the data. Set to -1 to start at NUMFRAMES from the end of the data. -h FIELD plot FIELD as a histogram. -l use lines when plotting curves. --landscape use landscape orientation for printing. Requires --print. --Letter use US Letter sized paper for printing. Requires --print. -n NUMFRAMES plot at most NUMFRAMES frames of data. Set to -1 to indicate all of the data. -P PLOTNAME plot all plots in the plot named PLOTNAME. -p FIELD plot FIELD as a power spectrum plot. --png filename render to a portable network graphics (png) image with file name filename and quit. --portrait use portrait orientation for printing. Requires --print. --print filename print the plot to file filename and quit. -s FRAMESPERSAMPLE plot every FRAMESPERSAMPLE frames when plotting. -x FIELD use FIELD as the X-axis vector. -y FIELD plot FIELD as an XY plot. -z FIELD plot FIELD as an image. EXAMPLES
Plot all data in column 2 from data.dat. kst data.dat -y 2 Same as above, except only read 20 lines, starting at line 10. kst data.dat -f 10 -n 20 -y 2 also read col 1. One plot per curve. kst data.dat -f 10 -n 20 -y 1 -y 2 Read col 1 from data2.dat and col 1 from data.dat kst data.dat -f 10 -n 20 -y 2 data2.dat -y 1 Same as above, except read 40 lines starting at 30 in data2.dat kst data.dat -f 10 -n 20 -y 2 data2.dat -f 30 -n 40 -y 1 Specify the X vector and error bars: Plot x = col 1 and Y = col 2 and error flags = col 3 from data.dat kst data.dat -x 1 -e 3 -y 2 Get the X vector from data1.dat, and the Y vector from data2.dat. kst data1.dat -x 1 data2.dat -y 1 Placement: Plot column 2 and column 3 in plot P1 and column 4 in plot P2 kst data.dat -P P1 -y 2 -y 3 -P P2 -y 4 BUGS
Please report bugs to either the kst mailing list at kst@kde.org or to the kde bugzilla under the kst product at http://bugs.kde.org/. If you can run kst, you can easily report bugs by selecting Bug Report Wizard from the Help menu. AUTHOR
Matthew Truch <matt@truch.net> LICENSE
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the `COPYING.DOC' file as part of the kst distribution. Version 2.0.3 22 February 2011 kst(1)
All times are GMT -4. The time now is 02:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy