Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Perl - Parse text file with tags for data dump into new text file

Please check this one: use strict; use warnings; use Cwd;

#Get Directory
my $dir = getcwd();

#Grep files from the directory
opendir(DIR, $dir) || die "Couldn't open/read the
$dir: $!";
my @AllFiles = grep(/.txt$/i, readdir(DIR));

#Check files are available 
if(scalar(@AllFiles) ne '')
    #Create Text Files as per Requirement
    open(PAP, ">$dir/Papers.txt") || die
"Couldn't able to create the file: $!";
    open(BOOK, ">$dir/Book.txt") || die
"Couldn't able to create the file: $!";
    open(EDT, ">$dir/Editors.txt") || die
"Couldn't able to create the file: $!";
    open(AUT, ">$dir/Authors.txt") || die
"Couldn't able to create the file: $!";
else {  die "File Not found...$dir
"; } #Die if not found files
foreach my $input (@AllFiles)
    print "Processing file $input
    open(IN, "$dir/$input") || die "Couldn't able
to open the file: $!";
    local $/; $_=<IN>; my $tmp=$_;
    #Loop from <PaperTitle> to // end slash
        my $LoopCnt = $1;
        my ($pptle) =
        my ($abstr) =
        my ($pgrng) =
        my ($bktle) =
        my ($edtns) =
        my ($publr) =
        my ($years) =

        my ($EditorNames, $AuthorNames) = "";
        my $edtList = $1; my @Edlines = split/
/, $edtList;
        my $i ='1'; #Editor Count to check
        foreach my $EdsngLine(@Edlines)
            {  $EditorNames .= $i."".$1."	"; $i++;
            {  $EditorNames .= $1."	"; }
            {  $EditorNames .= $1."	"; }
        my $autList = $1; my @Autlines = split/
/, $autList;
        my $j ='1'; #Author Count to check
        foreach my $AutsngLine(@Autlines)
            {  $AuthorNames .= $j."".$1."	"; $j++;
            {  $AuthorNames .= $1."	"; }
            {  $AuthorNames .= $1."	"; }

        #Print the output in the crossponding text
        print PAP "$pptle	$abstr	$pgrng	//
        print BOOK
"$pptle	$bktle	$edtns	$publr	$years	//
        print EDT "$pptle	$EditorNames//
        print AUT "$pptle	$AuthorNames//

print "Process Completed...

#Don't forget to close the files

Categories : Perl

Related to : Perl - Parse text file with tags for data dump into new text file
How can I cache a csv for Papa Parse to parse?
The browser and server you're downloading the CSV file from should negotiate caching for you; I might misunderstand but I'm not sure what Papa Parse would have to do with that. For last modified date, if the file happens to be selected by the user with a <input type="file"> element on the page, you can access the File object and check its lastModified or lastModifiedDate properties (at leas

Categories : Javascript
parse variable to xml
Try this: var valueStation2; var xmlString = "<?xml version='1.0' encoding='UTF-8'?> <sos:GetFeatureOfInterestTime xmlns:sos='' service='SOS' version='1.0.0' xmlns:ows=''> <sos:FeatureOfInterestId>" + valueStation2 + "</sos:FeatureOfInterestId> </sos:GetFeatureOfInterestTime>"; var xmlPars

Categories : Javascript
How to parse String and get certain value
Use the below regex to match only the last number. "(?<!\d)\d+(?=\D*$)" DEMO String s = "casale-monferrato/incomincia-oggi-roma-l-ultimo-atto-processo-eternit-davanti-corte-cassazione-74506.html"; Pattern regex = Pattern.compile("(?<!\d)\d+(?=\D*$)"); Matcher matcher = regex.matcher(s); while(matcher.find()){ System.out.println(; } Output: 74506 Regular Exp

Categories : Java
PHP Parse error?
You forget the semicolon ';' in define('DB_PASSWORD', '*'); <?php define('DB_HOST', 'localhost'); define('DB_NAME', '*'); define('DB_USERNAME', '*'); define('DB_PASSWORD', '*'); $odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD); ?> Cheers.

Categories : PHP
Users not able to sign in using Parse
Make sure your login use the same parse init session as main activity. Create new user in your app. Verify parse dashboard shows the new entry in User table. Use curl to log on to your app from terminal session ( cmd) if on windows os. If u can curl cli log on following log on instruction in parse rest Api docs, then u know u r log on activity has bug.

Categories : Java
Recently Add
SSL error calling Perl web service via https using LWP
SOAP::Lite always faults in debug mode
perl referencing a hash outside of the scope that populated it (histogram)
Perl script to print out all the lines containing a keyword and the line below it
PERL Unicode Escape string pass from command line argument wrong output
Perl process crashes after handling signal
Marpa: Can I explicitly disallow keywords as identifiers?
Perl: Import text, containing ÅÄÖ, from file
error using perl - Proc::ProcessTable. works in cmd line, not in .pl file
DBIx::Class chaining resultsets with same table in prefetch
Time as input, print timetable in Perl
compare values of different tables perl
Automatically increasing ID generation using PERL
Syntax Error, first line after dostuff
Delete files in a folder using Perl
Perl '-d' operator is not detecting a directory
Perl appending text to new line
write_timeout in IO::Socket::Timeout
Using ForkManager and Perl properly?
Is a cyclic dependency solved with require?
Posting metric to google analytics from perl script
How can I check if a user enters my page the first time?
Sorting arrays of intervals in perl?
Perl: How to get the link target of a soundcloud feed mp3
Uninitialized value in concatenation
Perl code - pipe "|" in `open()` statement
perl command line backticks with matrix
Perl OO - Creating a list of objects
extract gene-id + function annotation from .gff
How to receive parameters and values from POST method in Perl CGI?
© Copyright 2017 Publishing Limited. All rights reserved.