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. |
Perhaps you haven't read the sed manpage closely enough. It usually suffices.
|
It would be a fair challenge, if you knew for sure OP reads English well enough. Otherwise it could be better to explicitly mention option '-i'
|
thanks
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. |
Quote:
Then you can try some sed program like the following: Code:
sed -e '/Some Text/!d; s/^[^"]*"//; s/"[^"]*$//;' inputfile.txt > outputfile.txt |
Code:
sed -i.bak 's;keyword="old";keyword="new";' somefile.ext |
i whant import in file in this case.
Code:
sed -i.bak 's;keyword="old";keyword="new";' somefile.ext 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 be very surprising:
Code:
sed -i.bak 's;keyword="";keyword="new";' somefile.ext |
yes but doesent work i try already somehove all command seems to work evry fifth time something strange.
but i found now my self basic solution i dont know way i didnt try before maybe all reading scare me about sed. sed -i 's/""/"sometext"/' file.txt or if need specify directory sed -i 's/""/"some:\/"/' file.txt thanks for help prichiated now sed is cool |
Quote:
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. |
you can look in grub file /etc/default/grub, on arch is at fifth line
GRUB_CMDLINE_LINUX="" i whant to look GRUB_CMDLINE_LINUX="crypt=/dev/sdaX:cryptroot" can i put in sed that affect only fifth line of file he will not delete all other content. |
Kindly do exactly what your are told, not just something similar...
Code:
sed -i.bak 's;GRUB_CMDLINE_LINUX="";GRUB_CMDLINE_LINUX="crypt=/dev/sdaX:cryptroot";' /etc/default/grub |
yes you are right it workink.
thanks both for help it realy help a lot to simplify this to me, and good base for rest of book. and way i cant click post helpfull it say you need to have at least one post to rate post. |
it was something with my browser about rate post
|
All times are GMT -5. The time now is 05:55 AM. |