How to copy-paste part of line within the file?
Hi,
i am a noob to linux and need some help. I am having a file called 2009.txt and the part of the content is - Code:
<articles> The Author could be anything and not necessarily DPA so is there a way to do it in Linux? |
Do you want to do it with a program (in which case, in which language?) or in an editor (in which case, which editor?).
|
Code:
$ awk '/<author>/{o=$0}/<content>/{$0=$0"\n"o}1' file |
in an editor called vi, start by vi <filename> --> place cursor below D of DPA --> <ESC> Key once (not necessarily) --> type "yw" (without quotes) which copies one word --> goto content line and place cursor where you want and type "p" (without quotes)
|
any idea how do I save(modify) the change in the same file? Its only displaying me the results.
Is it possible to copy only the text within <author> </author> part? I dont want to copy <author> word. Quote:
|
Quote:
Quote:
Code:
awk '/<author>/{gsub(/<author>|<\/author>/,"");o=$0}/<content>/{$0=$0"\n"o}1' file |
Hi,
Thx, I used this script to make the change - Code:
find *.txt -type f | while read file Code:
mv: missing destination file operand after `20099.txt.26848' Quote:
|
Quote:
|
Quote:
I am a noob and learning. Have to do it for my project. :(( |
the problem is with your mv command. type man mv on your command prompt. then read about how its used. You will not find ">" there.
|
I figured it out. Sorry for being so dumb. Thx for all your help.
|
All times are GMT -5. The time now is 01:46 AM. |