How to merge two files into a single one? (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

How to merge two files into a single one? (Solved)

#1 Post by RSH »

Hi.

I want to merge file1.xml and file2.xml to file3.xml.

Also I want to do this with two bash script files.

Actually with files AppInfo.xml and AppRun from within a RoxApp Directory (AppDir).

Any tips (or even fully working code :lol: )?

RSH
Last edited by RSH on Tue 12 Nov 2013, 07:06, edited 1 time in total.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

jplt

#2 Post by jplt »

Maybe

Code: Select all

cat file1 file2 > file3 

vanchutr
Posts: 438
Joined: Sat 05 Aug 2006, 12:04

other suggest

#3 Post by vanchutr »

Please test this:
Attachments
merge.tar.gz
(626 Bytes) Downloaded 268 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

Hi RSH; You don`t give any specs about what the results are to be.
But I assume you want file1 first, file2 second, etc...
So it`s a matter of stripping header info. appropriately before concating them.
I`ve done this with GtkDialog code to merge separate dialogs onto tabs on a main dialog.

Need more info. dude.!
.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#5 Post by RSH »

Sorry for being incomplete.

Though, you are on the right direction.
So it`s a matter of stripping header info. appropriately before concating them.
I`ve done this with GtkDialog code to merge separate dialogs onto tabs on a main dialog.
I want to insert AppInfo.xml and AppRun of a new created RoxApp into those files of an already existing RoxApp.

Actually code

<appmenu>

...

</appmenu>

and

case ACTION in

...

esac

<appmenu> section completely

case ACTION section the parts in between of case and esac.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

What does AppInfo.xml do exactly.? None of my AppDirs have one, and they don`t need it.
And AppRun in all of mine are links, and .DirIcon is a link too.

I assume your AppRun is a std. shell script. And AppInfo.xml is a std. XML file.

# Do you want this.?
================
The shell header ( #!/bin/sh ).
Then AppInfo.xml text.
Then the scripts body.

It seems like you`re wanting to insert some XML into a case statement? Full example...
.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#7 Post by amigo »

You can't simply 'cat' two xml files or scripts together and have them be valid or work. Time to whet your scripting skills... All of the AppRun scripts I've seen here are extremely simple so it shouldn't be a big deal to incorporate the functionality you want from one of them into another -ask for scripting help in a separate thread. Also, editing a couple of AppInfo.xml files into one should be a simple cut-n-paste operation or hand editing as they are quite short and have no multi-line entries.

When present, an AppInfo.xml provides a bit of info about the app and, optionally, right-click menu items. It's really a good idea to use one and include a version number in there.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

amigo; I`m curious, what does an AppDir need a right click menu for?

IF more than one app, clicking an AppPkg pops up a menu.
Like Xfe is suite of 5 apps., so clicking it gets a menu of 5 buttons.
.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#9 Post by RSH »

sunburnt wrote:amigo; I`m curious, what does an AppDir need a right click menu for?
Yes, if it contains only one application, doesn't make sense to have a menu.

But, if the AppRun script offers several options/functions you need at least to have a menu.

Did you try the Modularity-Package? If so, do a right-click onto /root/my-roxapps/Advanced-SFS-PLUS-Suite and have a look into its AppRun.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#10 Post by sunburnt »

RSH; I guess my point was the difference between left-click and right-click.
Right-click is usually for settings and preferences, not that an AppDir couldn`t have those.
But to left-click is to run an app or menu.

# A guess... Right-click is for non-RoxFiler file managers to run AppDir packages?
.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#11 Post by amigo »

Have you ever right-clicked on the ROX-Filer icon itself? The items available under the right-click menu correspond to command-line arguments which can be passed to the real application and can be used the same way.

It's important to note that any AppRun can be linked into a normal path so that the AppDir can be run using other file managers, or from terminal even. ( cd some-AppDir && ln -sf AppRun /usr/bin/name-of-prog)

I'll attach a simple wrapper-type AppDir which lets you choose which terminal-emulator to run by right-clicking, or simply run xterm by left-clicking. I call these simple AppDir which act as wrappers to programs which are already installed WrapDir's -as opposed to AppDir's which include binaries or other scripts.

Once you study a few different ways of using the AppRun you'll see that AppDir's are more useful than what you thought. Most of the ones you get from the rox website use python, but long ago I did away with all that so that they have the same functionality using shell.

Summarizing a bit, an AppRun can be made to:
1. left-click to run a single program
2. right-click to choose a menu option this can be either run immediately or only used to change a setting so that when you left-click that will be run
3. run a program found inside the AppDir
4. compile sources and install a program inside the AppDir and then run it.

The advantage of right-click options is that they are handled natively. internally by gtk/ROX. Of course, you can have a left-click action which options some sort of dialog or menu which allows you to choose options/actions. But this dialog is external and so may be less universal -if you use gtkdialog for this dialog then not all systems have it, etc.
Attachments
Terminal-0.1.tar.bz2
(2.74 KiB) Downloaded 241 times

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#12 Post by RSH »

RSH; I guess my point was the difference between left-click and right-click.
Right-click is usually for settings and preferences, not that an AppDir couldn`t have those.
But to left-click is to run an app or menu.
Hm, I just don't know, how to create a menu for left-click.
# A guess... Right-click is for non-RoxFiler file managers to run AppDir packages?
No.

I saw the right-click menu first in /usr/local/apps/Wallpaper (Nathan's Wallpaper Setter), which has a 'About' entry plus one to Start/Stop Slideshow.

As I thought about to use RoxApp directories for the use as application starters, it was logically to me, to use a right-click menu for a selection of installed applications related to the RoxApp's category used when creating it - eg. Text Editors.

Left-click runs the defaulttexteditor script, right-click offers all installed text editor applications to select one.

This was the basic intention for the invention of the RoxApp Builder, because I did not want to create a RoxApp dir application manually for the use 814 .desktop files (applications) sorted in categories.

Why such application starters?

I wanted to have less icons on desktop as possible, but offering most applications possible. First thought was to use programs like PupMenu, but found quickly, it's not really usable for what I did want. So, the RoxApp comes in mind.

However:

I have solved the above posted issue. Some ugly code, but works for what it is intented - the RoxApp Builder.

Since its created files do have equal form and structure, I did insert a 'Identifier-Line'. Now the RoxApp Builder is able to combine two RoxApp dir application starters into a single one! :D

I do plan to publish the RoxApp Builder and SFS P.L.U.S. for the community when RoxApp Builder is 1.xx (currently 0.9.0) AND SFS P.L.U.S. is 4.xx (currently 3.9.3) and to develop/maintain it, if there will be any interest.

Those versions in the Modularity Package are working well, but they are only for current testings - they will be removed then.

Ok: solved.

RSH
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#13 Post by sunburnt »

I think the xml file is what pops up the right click menu ( probably a GTK popup menu ).

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#14 Post by amigo »

When viewing an AppDir wirh ROX, it will always have some right-click options available -even if no AppInfo.xml is available.

However, using the AppInfo.xml will provide a 'tooltip' when you hover over the AppDir with the mouse pointer. This is provided by the xml entry <Summary>tooltip text here</Summary>

The AppInfo.xml can also contain custom menu items when right-clicking. They go in structure like this:
<AppMenu>
<Item label="Eterm" option="eterm"/>
<Item label="Aterm" option="aterm"/>
.....
</AppMenu>

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#15 Post by RSH »

Just to make a full (hopefully) picture.

Code: Select all

<?xml version="1.0"?>
<AppInfo>
	
	<Summary xml:lang="en">SFS P.L.U.S. Suite GUI - a GUI for the applications of the SFS P.L.U.S.!</Summary>
	<Summary xml:lang="de">SFS P.L.U.S. Suite Arbeitsumgebung - eine Benutzeroberfläche für die Programme des SFS P.L.U.S.!</Summary>
	
	<About xml:lang="en">
		<License>GNU Public License 2</License>
		<Version>SFS P.L.U.S. 3.8.x</Version>
		<Homepage>(RSH, R-S-H) - http://puppy-linux.org/</Homepage>
	</About>
	<About xml:lang="de">
		<License>GNU Public License 2</License>
		<Version>SFS P.L.U.S. 3.8.x</Version>
		<Homepage>(RSH, R-S-H) - http://puppy-linux.org/</Homepage>
	</About>
	
	<AppMenu>
		
		<Item icon="gtk-info" option="-about">
			<Label xml:lang="en">About SFS P.L.U.S. Suite GUI</Label>
			<Label xml:lang="de">Über SFS P.L.U.S. Suite Arbeitsumgebung</Label>
		</Item>
		
		<Item icon="sfs-plus" option="-guiexec">
			<Label xml:lang="en">Run SFS P.L.U.S. Suite GUI</Label>
			<Label xml:lang="de">SFS P.L.U.S. Suite Arbeitsumgebung starten</Label>
		</Item>
		
	</AppMenu>
	
</AppInfo>
It shows nicely, how to make a AppInfo.xml file for different Languages.
It can have sub-menus as well.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#16 Post by amigo »

It's a quite useful option if you don't get carried away with too many entries.
To make such options useful you'll need to handle them in the AppRun script.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#17 Post by RSH »

It's a quite useful option if you don't get carried away with too many entries.
To make such options useful you'll need to handle them in the AppRun script.
You might want to have a look into this?
http://murga-linux.com/puppy/viewtopic. ... 139#736139
My RoxApp Builder creates such files automatically for Application-Starters using a Sub-Menu and categorized Sub-Sub-Menus - and these Application-Startes are able to re-build themselves when needed/wanted (e.g. when a new application has been installed)!
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#18 Post by amigo »

Can you post the typical content of one your AppRun scripts which are generated?

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#19 Post by RSH »

Attached is the RoxApp Application-Starter created using category TextEditor.

It contains all files of the typical content created by the RoxApp Builder.

I did not change anything manually, so there might be some German parts, because of creating it under DE interface.

Note: top entry (will be DE in this example) is to let the RoxApp rebuild it self. This will only work, if RoxApp Builder is installed.

Note2: other RoxApps created by RoxApp Builder will have some other content.

Ah, and Note3: you might not be able to execute any other application except nicoedit - because you don't have the RunScripts in /root/.my-sfs-scripts (AppRun will show them)
Attachments
RoxAppStarter-TextEditors.tar.gz
(9.51 KiB) Downloaded 154 times
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#20 Post by sunburnt »

So there must be a backend utility that parses the xml and pops the gtk menu up.?
All run by Rox I assume. So then Rox Filer is calling the shots on the AppDir behavior.
Just like it`s real nice to move away from gtk, it`d also be real nice to get rid of Rox.

Post Reply