---------- Post updated at 08:02 AM ---------- Previous update was at 07:55 AM ----------
You have "\n" in the java script, so will not get what you want!
--ahamed
Okay, I get "awk: cmd. line:1: warning: escape sequence `\/' treated as plain `/'" when I run the command but I do get the text insertion.
You are correct though. I do not get "\n" in the insertion. This script is for printing a specific section of a web page when clicking a print button. If I remove the \n's it still works, however, it seems to print in landscape rather than portrait. Am I correct in assuming \n indicates newline? Any way to circumvent the \n situation?
I am iterating record by record through a file as below,
A,B
A,C
A,D
B,E
B,F
E,G
E,H
The same file should look like in the final output as below,
A,B
B,E
E,G
E,H
B,F
A,C
A,D (10 Replies)
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
Hi ,
This is my first thread ; facing some issues withmy sed script
I need to insert the code from my log file which is between two keywords.
content is like this ........
log
############################
log1 log2
231 "Ban" "tom" and the line one of the cross line
friend... (2 Replies)
Hi All ,
Given a file , I need to delete , modify and insert lines matching certain patterns in that file using shell scripting.
e.g. If a file FILE1 has following content :
CUST.ABC.DEF = CUST.ABC.DEF * CUST.ABC.DEF
PRINTF(CUST.ABC.DEF)
CUST.ABC.DEF = mid(CUST.ABC.DEF,10.34)... (5 Replies)
Hi,
For the text file let us say t.txt having the statements as below.
filename : t.txt.
Contents :
This is first string1
This is first string2
This is first string3
The output of the file should have newline. How to introduce the new line so that the output be as follows
... (5 Replies)
Hello,
I have two text files (txt1 and txt2). txt1 contains many lines with a single number in each line. txt2 (xml format) contains information about the numbers given in txt1. I need to insert one line in txt2 within the scope of each number taken from txt1.
Sample problem:
txt1:
12
23... (1 Reply)
I have a huge file with record length around 5000 characters.
There is an ETL tool datastage which is writing this data to the file(AIX server). At position 4095 i have seen NULL Character(^@).
when i am using this command "head -1 file_nm | sed 's/\000//g'" --- the output is displaying... (3 Replies)
Hi There,
I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB
My exiting csv record... (6 Replies)
I have a script which is extracting data from a database in an excel file in below given format,
date_time calling_app1 count of requests
date calling_app x 34
date calling_app y 1034
I want to write a script which will write data into a file like this ... (3 Replies)
Discussion started by: TNT47
3 Replies
LEARN ABOUT DEBIAN
javascript::packer
JavaScript::Packer(3pm) User Contributed Perl Documentation JavaScript::Packer(3pm)NAME
JavaScript::Packer - Perl version of Dean Edwards' Packer.js
VERSION
Version 1.006003
DESCRIPTION
A JavaScript Compressor
This module is an adaptation of Dean Edwards' Packer.js.
Additional information: http://dean.edwards.name/packer/
SYNOPSIS
use JavaScript::Packer;
my $packer = JavaScript::Packer->init();
$packer->minify( $javascript, $opts );
To return a scalar without changing the input simply use (e.g. example 2):
my $ret = $packer->minify( $javascript, $opts );
For backward compatibility it is still possible to call 'minify' as a function:
JavaScript::Packer::minify( $javascript, $opts );
The first argument must be a scalarref of javascript-code.
Second argument must be a hashref of options. Possible options are:
compress
Defines compression level. Possible values are 'clean', 'shrink', 'obfuscate' and 'best'. Default value is 'clean'. 'best' uses
'shrink' or 'obfuscate' depending on which result is shorter. This is recommended because especially when compressing short scripts the
result will exceed the input if compression level is 'obfuscate'.
copyright
You can add a copyright notice at the top of the script.
remove_copyright
If there is a copyright notice in a comment it will only be removed if this option is set to a true value. Otherwise the first comment
that contains the word "copyright" will be added at the top of the packed script. A copyright comment will be overwritten by a
copyright notice defined with the copyright option.
no_compress_comment
If not set to a true value it is allowed to set a JavaScript comment that prevents the input being packed or defines a compression
level.
/* JavaScript::Packer _no_compress_ */
/* JavaScript::Packer shrink */
EXAMPLES
Example 1
Common usage.
#!/usr/bin/perl
use strict;
use warnings;
use JavaScript::Packer;
my $packer = JavaScript::Packer->init();
open( UNCOMPRESSED, 'uncompressed.js' );
open( COMPRESSED, '>compressed.js' );
my $js = join( '', <UNCOMPRESSED> );
$packer->minify( $js, { compress => 'best' } );
print COMPRESSED $js;
close(UNCOMPRESSED);
close(COMPRESSED);
Example 2
A scalar is requested by the context. The input will remain unchanged.
#!/usr/bin/perl
use strict;
use warnings;
use JavaScript::Packer;
my $packer = JavaScript::Packer->init();
open( UNCOMPRESSED, 'uncompressed.js' );
open( COMPRESSED, '>compressed.js' );
my $uncompressed = join( '', <UNCOMPRESSED> );
my $compressed = $packer->minify( $uncompressed, { compress => 'best' } );
print COMPRESSED $compressed;
close(UNCOMPRESSED);
close(COMPRESSED);
AUTHOR
Merten Falk, "<nevesenin at cpan.org>"
BUGS
Please report any bugs or feature requests through the web interface at http://github.com/nevesenin/javascript-packer-perl/issues
<http://github.com/nevesenin/javascript-packer-perl/issues>.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc JavaScript::Packer
COPYRIGHT & LICENSE
Copyright 2008 - 2012 Merten Falk, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-03-02 JavaScript::Packer(3pm)