awk/grep copy and paste and insert in between lines.
Hi all,
I'm a unix newb andI'm trying to write a script that can copy some text paste it in a certian place and then add a number. It's not really clear but I'll show an example.
what the file looks like right now:
Desired output:
As you can see the first line of the txt file was copied and inserted between 23:59:01 and 00:05:01 with the date changed to 07/16/09. I'm thinking something along the lines of adding one using awk could solve this problem? I'm not sure, but basically i can use any utility including but not limited to awk, sed, perl to do this.
Thanks so much unix community,
the1hand3r.
Last edited by vgersh99; 07-17-2009 at 09:01 PM..
Reason: code tags, PLEASE!
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.
@vidyadhar85
I used your command and it produced this output:
It doesn't show the date =(
@summer cherry
I was not able to get the script to run in my terminal. I think I might be doing something wrong, b/c when I copy and pasted the code into the terminal, it gave me a message saying:
@kshji
I'm sorry, but I'm like I said I'm a newb at linux, but your idea seems very plausible. Can you elaborate on how I would go about changing the crontab file more in depth, and I'm not sure what I should type into /some/script. the file name is called tester and it is located in my home directory. Thanks.
Thanks everyone, but I'm still unable to complete this task. Any sugesstions/help would be appreciated!
echo $HOME
take that string and add your script name. That is full path for your script.
ex. /u2/home/userxxx/myscript.sh
Did you try to edit crontab file using command ?
0 0 * * *
=00:00 everyday do something
If you have not priledge to edit logfile, then give this crontabline for user who has.
I have rrd file which is have the gaps and I want to fill it out with some value , I've got 10 NaN record and I try to populate data from 10 records be for NaN to change instead of NaN :(
<!-- 2016-05-19 14:10:00 CST / 1463638200 -->... (11 Replies)
hi,
I have Multiple files with the following data :
File1
100414 DR1
END
XXXXX
Test1 Test2 Test3
Test4 Test5 Test6
END
100514 DR2
END
XXXXX
Test7 Test8 Test9
Test10 Test11 Test12
END
100614 DR3 (5 Replies)
Dear All,
Suppose I have a file:
1 1 1 1
2 2 2 2
3 3 3 3I want to insert new line under each old line so that the file would become:
1 1 1 1
1 1 1 1
2 2 2 2
2 2 2 2
3 3 3 3
3 3 3 3How can this be accomplished using awk (or sed)? (5 Replies)
I'm attempting to insert multiple lines before a line matching a given search pattern. These lines are generated in a separate function and can either be piped in as stdout or read from a temporary file.
I've been able to insert the lines from a file after the pattern using:
sed -i '/pattern/... (2 Replies)
Hi everybody,
I have two XML files.
I am working on a script that could copy and paste the contents of the first xml file to the desired location in the second xml file.
Here is my first XML file.
This is the second XML file.
Finaly, I wnat to obtain something like that :
... (2 Replies)
Dear All,
I am working with windoes OS but remote a linux machine. I wonder the way to copy an paste some part of a huge file in linux machine.
the contain of file like as follow:
...
dump annealling all custom 10 anneal_*.dat id type x y z q
timestep 0.02
run 200000
Memory... (2 Replies)
Hi
I have a file in the foll. format
*RECORD*
*FIELD NO*
.......
.......
*FIELD TX*
Data
*FIELD AV*
Data
*FIELD RF*
*RECORD*
*FIELD NO*
.......
.......
*FIELD TX*
Data
*FIELD RF* (4 Replies)
Hello
I have a very large file where say each line is made up of 80 characters.
I want to cut the characters from 20-30 and 50-60 from each line and then insert a delimiter between them (# or | etc).
eg
input file
000000000131.12.20990000590425246363375670011200140406... (5 Replies)