Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Append line and variable at fixed postion in file in unix Post 302341584 by zaxxon on Thursday 6th of August 2009 07:50:14 AM
Old 08-06-2009
New user, yes, but you still do not use CODE tags even I asked you too. Might want to read my former post with the paragraph about CODE tags.

Try with printf instead of print.
This might be useful for you:
The GNU Awk User's Guide
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append line based on fixed position

Hi all; I'm having headache on append one line to another based on the fix position.Hope u guys can help. All i need to do is append the line that start with '3' to a line which start with '1' and the position for line 3 that i need to append is 22. The original file look like this: ... (2 Replies)
Discussion started by: ashikin_8119
2 Replies

2. Shell Programming and Scripting

Combining Two fixed width columns to a variable length file

Hi, I have two files. File1: File1 contains two fixed width columns ID of 15 characters length and Name is of 100 characters length. ID Name 1-43<<11 spaces>>Swapna<<94 spaces>> 1-234<<10 spaces>>Mani<<96 spaces>> 1-3456<<9 spaces>>Kapil<<95 spaces>> File2: ... (4 Replies)
Discussion started by: manneni prakash
4 Replies

3. Shell Programming and Scripting

replace only 1st word of a line if it comes in the subsequent lines at same postion.

I have a file like this.. Maharastra Mumbai worli Maharastra Mumbai navy maharatra Pune Maharastra Nagpur Karnataka Bangalore Karnataka Mysore Karnataka Mangalore Punjab Amritsar punjab Jalandar my expected outcome should be like this Maharastra Mumbai worli ---------- ... (9 Replies)
Discussion started by: geeko
9 Replies

4. Shell Programming and Scripting

shell script to read a line in gps receiver log file and append that line to new file

Hi, I have gps receiver log..its giving readings .like below Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GPSD,R=1 $GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71... (3 Replies)
Discussion started by: gudivada213
3 Replies

5. Shell Programming and Scripting

append each line on fixed position 31 to 33

I have a .DAT file like below. 26666666660001343 000001004OLF 029100020090820 27777777770000060 000001004ODL-CH001000020090820 28888888880000780 000001013OLF 006500020090820 ....... ........ and so on..... I want to append each line in a file in .KSH script with XXX with position... (5 Replies)
Discussion started by: kshuser
5 Replies

6. Shell Programming and Scripting

Need to append the last line of a file on UNIX Box

Dear Friends, I would like to apend the last line of one file on my UNIX box. Please let me know if you have any suggetsion for this. E.g: I have a file ABC as below Required Help Rajesh Amathi | | Thanks in advance. Result: I would like the get the output i.e. file ABC should... (9 Replies)
Discussion started by: rajeshamathi
9 Replies

7. Shell Programming and Scripting

Insert a variable to a text file after fixed number of lines

Hi, I am new to unix. I need to insert a variable which contains some lines of text into a text file after fixed number of lines.. Please help me on this.. Thanks in Advance, Amrutha (3 Replies)
Discussion started by: amr89
3 Replies

8. Shell Programming and Scripting

Append variable texts to the beginning of each line in all files in a directory

I am writing a code to append some numbers in the beginning of each line in all the files present in a directory. The number of files are really huge. The files are numbered as 1.sco, 2.sco, 4.sco (Note: 3.sco is missing). The files currently look like this: 1.sco 2 3 5 6 6 7My task is to... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

9. Shell Programming and Scripting

Append spaces the rows to make it into a required fixed length file

I want to make a script to read row by row and find its length. If the length is less than my required length then i hav to append spaces to that paritucular row. Each row contains special characters, spaces, etc. For example my file contains , 12345 abcdef 234 abcde 89012 abcdefgh ... (10 Replies)
Discussion started by: Amrutha24
10 Replies

10. Shell Programming and Scripting

How to pre-append a variable string to each line in a file?

How to pre-append a variable string to each line in a file contains both single and double quotes? The variable string has no quotes in it. thank you very much. :confused: (8 Replies)
Discussion started by: dtdt
8 Replies
SAMPLE1D(l)															       SAMPLE1D(l)

NAME
sample1d - Resampling of 1-D data sets SYNOPSIS
sample1d infile [ -Fl|a|c ] [ -H[nrec] ] [ -Ixinc ] [ -M[flag] ] [ -Nknotfile ] [ -Sxstart ] [ -Tx-col] [ -V ] [ -bi[s][n] ] [ -bo[s][n] ] DESCRIPTION
sample1d reads a multi-column ASCII [or binary] data set from file [or standard input] and resamples the timeseries/profile at locations where the user needs the values. The user must provide the column number of the independent (monotonically increasing or decreasing) vari- able. Equidistant or arbitrary sampling can be selected. All columns are resampled based on the new sampling interval. Several interpola- tion schemes are available. infile This is a multi-column ASCII [of binary, see -b] file with one column containing the independent variable (which must be monotoni- cally in/de-creasing) and the remaining columns holding misc. data values. If no file is provided, sample1d reads from standard input. OPTIONS
No space between the option flag and the associated arguments. -F Choose from l (Linear), a (Akima spline), and c (natural cubic spline) [Default is -Fa]. You may change the default interpolant; see INTERPOLANT in your .gmtdefaults file. -H Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults file. If used, GMT default is 1 header record. -I xinc defines the sampling interval. [Default is the separation between the first and second abcissa point in the infile] -M Multiple segment file. Segments are separated by a record whose first character is flag. [Default is '>']. -N knotfile is an optional ASCII file with the x locations where the data set will be resampled in the first column -S For equidistant sampling, xstart indicates the location of the first output value. [Default is the smallest even multiple of xinc inside the range of infile] -T Sets the column number of the independent variable [Default is 0 (first)]. -V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. -bi Selects binary input. Append s for single precision [Default is double]. Append n for the number of columns in the binary file(s). [Default is 2 (or at least the number of columns implied by -T]. -bo Selects binary output. Append s for single precision [Default is double]. EXAMPLES
To resample the file profiles.tdgmb, which contains (time,distance,gravity,magnetics,bathymetry) records, at 1km equidistant intervals using Akima's spline, try' sample1d profiles.tdgmb -I1 -Fa -T1 > profiles_equi_d.tdgmb To resample the file depths.dt at positions listed in the file grav_pos.dg, using a cubic spline for the interpolation, try sample1d depths.dt -Ngrav_pos.dg -Fc > new_depths.dt SEE ALSO
gmt(1gmt), filter1d(1gmt) 1 Jan 2004 SAMPLE1D(l)
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy