[SOLVED] import text beatwen symbols and save as original file
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
import text beatwen symbols and save as original file
hi
im writing script for installing arch linux. so after installing system [pacstrap] some config files need to modify and bootloader config. i whant that include in script. i try with sed but sed doesent save original file it creates another modyfy file with imported text. so what metod to use if i whant import text beatwenn "" -symbols and save original file without creating another file.
actualy im following book linux command line and bible. and examples that use i option is with echo text examples, and modify file after inport text is have to save as different file. and deffinitly my english. and if you have time hove to sepify lets say to import beatwen symbol in line.
in text file lets say i have Some Text="" , and i whant to import text beatwen quotation marks.
in text file lets say i have Some Text="" , and i whant to import text beatwen quotation marks.
sed is a little terse and so is the reference manual. But that also means it is simple once you get it. Try checking "man sed" on your system as you progress. Also see these guides:
Then you can try some sed program like the following:
Code:
sed -e '/Some Text/!d; s/^[^"]*"//; s/"[^"]*$//;' inputfile.txt > outputfile.txt
Can you say in more detail what you mean by importing the text between the quotes? Where do you want the text to end up, in a shell variable, a file, or somewhere else?
sed -i.bak 's;keyword="old";keyword="new";' somefile.ext
exacly this.
last two days im going throught book and writing evry example and now i see i dont think very much. its not that hard but thousunt things to combine i think i sleept half of book and i red first half.
and one more thing im boring i know, but same example some text="" but when beatween quotation marks there is no words or letters.
That will replace all the empty quotes in the whole file with the same string, though only one per line.
Also, it is a very good idea to add a suffice for -i to use. Without a suffix, sed will overwrite the existing file and you'll have no automatic backup copy. If you have a suffix on -i then you get a backup copy automatically with the suffix as an added extension.
Maybe you can show a few lines that you want to change and then show how you would like them to look after processing.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.