Sponsored Content
Top Forums Shell Programming and Scripting PERL: split 2 part from singel file. Post 302804819 by Mani_apr08 on Thursday 9th of May 2013 08:14:27 AM
Old 05-09-2013
Question PERL: split 2 part from singel file.

Hi,
I would like to split single fine into two array ..

Example: file.txt
--------------Installation --------------------
Code:
#GXTOOL=GxTools-20130501.tar.gz
GCSS=GExpLinux-BE-3700.0.12.37.tar.gz
TOP=TOPLinux-BE-3700.0.6.21.tar.gz
GHDER=GHDERLinux-BE-3700.0.6.20.tar.gz
ARCHIVE=ARCHIVELinux-BE-3700.0.3.21.tar.gz

--------------Fallback ------------
Code:
#GXTOOL=GxTools-20130128.6.tar.gz
GCSS=GExpLinux-BE-3600.0.7.704.tar.gz
TOP=TOPLinux-BE-3600.0.4.14.tar.gz
GHDER=GHDERLinux-BE-3600.0.4.11.tar.gz
ARCHIVE=ARCHIVELinux-BE-3600.0.0.48.tar.gz

And output should be

@a should be

--------------Installation --------------------
Code:
#GXTOOL=GxTools-20130501.tar.gz
GCSS=GExpLinux-BE-3700.0.12.37.tar.gz
TOP=TOPLinux-BE-3700.0.6.21.tar.gz
GHDER=GHDERLinux-BE-3700.0.6.20.tar.gz
ARCHIVE=ARCHIVELinux-BE-3700.0.3.21.tar.gz

@b should be

--------------Fallback ------------
Code:
#GXTOOL=GxTools-20130128.6.tar.gz
GCSS=GExpLinux-BE-3600.0.7.704.tar.gz
TOP=TOPLinux-BE-3600.0.4.14.tar.gz
GHDER=GHDERLinux-BE-3600.0.4.11.tar.gz
ARCHIVE=ARCHIVELinux-BE-3600.0.0.48.tar.gz


any advice on this ..

THanks,
Mani

Moderator's Comments:
Mod Comment Use code tags. You: Threads created: 46 - Posts: 105 - Posts Edited by a Moderator: 26 - Reminders from Moderators about formatting: 10
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl help to split big verilog file into smaller ones for each module

Hi I have a big verilog file with multiple modules. Each module begin with the code word 'module <module-name>(ports,...)' and end with the 'endmodule' keyword. Could you please suggest the best way to split each of these modules into multiple files? Thank you for the help. Example of... (7 Replies)
Discussion started by: return_user
7 Replies

2. Shell Programming and Scripting

Help fix my garbage - File Split Program in Perl

Hi, I have the following, it doesn't work and I know it's crap code. The objective is to split a file with a givin number of codes such as: 01,02,03,...,99 Then return all records with each seperate identifier in a new file. The files being split have lrecl=500, recfm=F, and I... (4 Replies)
Discussion started by: mkastin
4 Replies

3. Shell Programming and Scripting

how to get split output of a file, using perl script

Hi, I have file: data.log.1 ### s1 main.build.3495 main.build.199 main.build.3408 ###s2 main.build.3495 main.build.3408 main.build.199 I want to read this file and store in two arrays in Perl. I have following command, which is working fine on command prompt. perl -n -e... (1 Reply)
Discussion started by: ashvini
1 Replies

4. Shell Programming and Scripting

Perl or Awk script to copy a part of text file.

Hi Gurus, I'm a total newbie to Perl and Awk scripting. Let me explain the scenario, there is a DB2 table with 5 columns and one of the column is a CLOB datatype containing XML. We need all the 4 columns but only a portion of string from the XML column. We decided to export DB2 table to a .del... (26 Replies)
Discussion started by: asandy1234
26 Replies

5. Shell Programming and Scripting

Perl Split for text in file

Hi all I have written Perl script to swap the strings in the second a third column from a text file. My input file format is : the|empty|the|det lake|empty|lake|conj_and was|empty|was|auxpass drained|empty|drained|conj_and birds|empty|bird|s|nn The expected output file format is... (11 Replies)
Discussion started by: my_Perl
11 Replies

6. Shell Programming and Scripting

How do I split file into pieces with PERL?

How do I split file into pieces with PERL? IE file.txt head 1 2 3 4 end head 5 6 7 8 9 end n so on (7 Replies)
Discussion started by: 3junior
7 Replies

7. Shell Programming and Scripting

awk to split one field and print the last two fields within the split part.

Hello; I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Discussion started by: yifangt
5 Replies

8. Shell Programming and Scripting

perl script to split the text file after every 4th field

I had a text file(comma seperated values) which contains as below 196237,ram,25-May-06,ram.kiran@xyz.com,204183,Pavan,4-Jun-07,Pavan.Desai@xyz.com,237107,ram Chandra,15-Mar-10,ram.krishna@xyz.com ... (3 Replies)
Discussion started by: giridhar276
3 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Perl Question - split function with csv file

Hi all, I have a csv file that appears as follows: ,2013/03/26,2012/12/26,4,1,"2017/09/26,5.75%","2017/09/26,1,2018/09/26,1,2019/09/26,1,2020/09/26,1,2021/09/26,1",,,2012/12/26,now when i use the split function like this: my @f = split/,/; the split function will split the data that is... (2 Replies)
Discussion started by: WongSifu
2 Replies

10. Shell Programming and Scripting

Perl : to split the tags from xml file

I do have an xml sheet as below where I need the perl script to filter only the hyperlink tags. <cols><col min="1" max="1" width="30.5703125" customWidth="1"/><col min="2" max="2" width="7.140625" bestFit="1" customWidth="1"/> <col min="3" max="3" width="32.28515625" bestFit="1"... (3 Replies)
Discussion started by: scriptscript
3 Replies
SHAPE_TAR(1)						      General Commands Manual						      SHAPE_TAR(1)

NAME
shape_tar - shapeTools RMS bundle up subsystem in a tar or shar archive SYNOPSIS
shape tar[VERSIONS=<version_selection_rule>] [ARCHIVE=<filename>] shape shar[VERSIONS=<version_selection_rule>] [ARCHIVE=<filename>] DESCRIPTION
Shape tar and shape shar create a tar or a shar archive containing all source components of the current node in the system tree. All source components listed in the COMPONENTS macro in the Makefile and the release identification file (VERSIONFILE) are written to the archive. Components of subsystems are not included in the archive file. The VERSIONS macro may be set to specify a version selection rule to be active during archive file creation. Default is most_recent, selecting the most recent version of each component. See shape_stdrul(7) or the $(SHAPELIBPATH)/stdrules for other possible settings. You may also use self defined version selection rules as VERSIONS. ARCHIVE is the base name of the file where the output shall be written to. Default is $(SUBSYSTEMNAME). The output file gets the filename extension .tar (resp. .shar). When ARCHIVE=- is given, data will be written to standard output. SEE ALSO
shape_RMS(1), shape_stdrul(7) FILES
$(SUBSYSTEMNAME).tar $(SUBSYSTEMNAME).shar 28.9.119 SHAPE_TAR(1)
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy