Append line and variable at fixed postion in file in unix
Hi
I have a input file :::
1583904589034853904
1690234849023849023
159823890238409
1690238490238490238490
.
.
.
The output file should have the record 16 appended to the record 15 and a variable should be added at a FIXED POSTION at 55.
The records are been processed inside a loop in a unix script.
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
The variable appended should not depend on the lines which have been appended.The length of the line can vary and the variable should be at a fixed position.Also the 2 lines have been appended and I have to append a varible at a fixed postion.
For eq
Variable is 12345
And this has to appended to the line at postion 55.
The line is
1576789689789 1678978789787
15988789789789087 16778907097907
1589787870 167907907907907907
I have got till this point.Now I have to the variable at position 55 for each line.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)