Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 18 Dec 2014, 20:45
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to merge two files into a single one? (Solved)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [20 Posts]   Goto page: 1, 2 Next
Author Message
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Sun 10 Nov 2013, 15:48    Post subject:  How to merge two files into a single one? (Solved)
Subject description: 2 x XML and 2 x BASH Script
 

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 Laughing )?

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.

Last edited by RSH on Tue 12 Nov 2013, 03:06; edited 1 time in total
Back to top
View user's profile Send private message 
jplt


Joined: 12 Nov 2010
Posts: 160
Location: Terre

PostPosted: Sun 10 Nov 2013, 19:10    Post subject:  

Maybe
Code:
cat file1 file2 > file3

_________________
Acer Aspire 5020ZG 2go RAM > Frugal Install Puppy Precise 5.7.1
Packard Bell 1go RAM > Triton 5.7.3
Back to top
View user's profile Send private message 
vanchutr

Joined: 05 Aug 2006
Posts: 427

PostPosted: Sun 10 Nov 2013, 19:48    Post subject: other suggest  

Please test this:
merge.tar.gz
Description 
gz

 Download 
Filename  merge.tar.gz 
Filesize  626 Bytes 
Downloaded  147 Time(s) 
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Sun 10 Nov 2013, 21:33    Post subject:  

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.!
.
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Sun 10 Nov 2013, 21:54    Post subject:  

Sorry for being incomplete.

Though, you are on the right direction.

Quote:
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.

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Mon 11 Nov 2013, 00:55    Post subject:  

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...
.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2288

PostPosted: Mon 11 Nov 2013, 04:51    Post subject:  

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.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Mon 11 Nov 2013, 18:10    Post subject:  

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.
.
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Mon 11 Nov 2013, 18:37    Post subject:  

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.

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Mon 11 Nov 2013, 19:49    Post subject:  

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?
.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2288

PostPosted: Tue 12 Nov 2013, 02:50    Post subject:  

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.
Terminal-0.1.tar.bz2
Description 
bz2

 Download 
Filename  Terminal-0.1.tar.bz2 
Filesize  2.74 KB 
Downloaded  139 Time(s) 
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 12 Nov 2013, 03:04    Post subject:  

Quote:
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.

Quote:
# 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! Very Happy

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

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Tue 12 Nov 2013, 20:22    Post subject:  

I think the xml file is what pops up the right click menu ( probably a GTK popup menu ).
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2288

PostPosted: Wed 13 Nov 2013, 02:29    Post subject:  

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>
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Wed 13 Nov 2013, 08:27    Post subject:  

Just to make a full (hopefully) picture.

Code:
<?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.

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [20 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1198s ][ Queries: 12 (0.0325s) ][ GZIP on ]