Going places with a Dolphin (adding to xml in sequence)
Hi all, I hope someone can help me write a script that:
Reads the xml file which holds Dolphins "Places" in KDE.
If a specific tag is not there, it should create a set for it, in order.
so this little file lives in
~/.kde/share/apps/kfileplaces/bookmark.xml
Here is my example.
So it should look for a specific title, and if it is not there, create a set in sequence
for example you are looking for the title SuperDirectory, and if it is not in that file, create it.
should be injected above </xbel>. So 1295957584 needs to be held as a variable I guess and then /4 figured out and tagged on.
I am thinking it should be a perl script... only... I haven't ever worked with perl, and I haven't had to work my brain in a decade either. I would really appreciate the help.
---------- Post updated at 11:17 AM ---------- Previous update was at 12:15 AM ----------
So I have been reading.
It seems like the smartest thing to do is parse the file, create an array out of the ID tags. and add 1 stored as a variable.
Then I guess I can just delete that end tag, and stuff a new bookmark set using the variable and replace the end tag... because it looks like xml doesn't much like appending sets.
Thank you. New to Linux... programmed a few languages in the past. Never written a shell script.
So it looks like sed is going to be my friend. Ignoring the array right now, because I need baby steps, and I expect I will work that out even though it seems more complicated than what I am trying to do now..
Ok... I can just echo that over. Working on creating that odd array. I guess I will make a variable out of the number before the slash, and then a +1 array to variable for after.
I could use some direction on how to remove the slash, and create two variables... even if I just grab the last tag to split it, and add one to the end.
Not really there but closer
Thanks again.
---------- Post updated at 06:57 PM ---------- Previous update was at 03:50 PM ----------
I'm thinking I should be writing this in perl.
Of course I know even less about that.
---------- Post updated 01-31-11 at 01:00 AM ---------- Previous update was 01-30-11 at 06:57 PM ----------
This is for FOSS if it matters. I would just like direction, not solutions.
Hi All ,
I have a file which contains data(comma separated) in below format :
500,Sourav ,kolkata ,8745775020,700091
505,ram,delhi ,9875645874,600032
510 ,madhu ,mumbai ,5698756430 ,500042
515 ,ramesh ,blore ,8769045601 ,400092
I want to add unique sequence number at the start of each... (7 Replies)
Hi
I am try to use sed to remove decleration information from an XML file however their are special characters in the string and sed is not able to parse it . I am using the following commond.
sed -e "s/xmlns=http://www.abc.com/integration/services/testtemplate1//g" Orginal.xml... (3 Replies)
Hi,
I have to append 2 files and while appending i need to add a running sequence number (counter ) for each line at the first column.
For e.g. If file x contains details as below.
Tom
Dick
Harry
Charlie
and file y contains
Boston
Newyork
LA
Toledo
Then the new file should... (1 Reply)
Hi All,
I need to create a script which checks for a particular file for eg.kumar1.txt.
If kumar1.txt is already exist the script should increment the file name as kumar2.txt and so on.
Please Advise.
Thanks & Regards,
Kumar66 (2 Replies)
How do I add the sequence number to the file? I have a file seperated by commas.
appusage,243,jsdgh,798
appusage,876,0989,900
.
.
appusage,82374,ajfgdh,9284
The output would be as below
1,appusage,243,jsdgh,798
2,appusage,876,0989,900
.
.
100,appusage,876,0989,900 (5 Replies)
I have a file name -HRCFTSIN05PLA1602100430444444
my requirement is to split the file in 10000 count each file and to add sequence number.rch at the end of each file.
output should be in this format
HRCFTSIN05PLA160210043044444401.rch
HRCFTSIN05PLA160210043044444402.rch... (4 Replies)
Can someone please help.
I need to add a sequence number to the start of each line of a file.
It needs to be 6 characters long. ie 000001 next line starts 000002 etc. (4 Replies)
I have a pipe delimited file I need to add a sequence number to in the third field. The record fields will be variable length, so I have to parse for the second pipe. Another requirement is that the sequence number must be unique to all records in the file and subsequent files created, so the... (5 Replies)