01-27-2013
HI. that would work, yes but it would introduce excess whitespace. An extra recalculation of the fields ( $0=$0 ) first reduces the number of fields (if duplicates were removed), so that after that, by recalculating the record ( $1=$1 ) the excess whitespace gets removed...
Last edited by Scrutinizer; 01-28-2013 at 01:59 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How can i read all the unique words in a file, i used -
cat comment_file.txt | /usr/xpg6/bin/tr -sc 'A-Za-z' '/012'
and
cat comment_file.txt | /usr/xpg6/bin/tr -sdc 'A-Za-z' '/012'
but they didnt worked..... (5 Replies)
Discussion started by: aditya.ece1985
5 Replies
2. Shell Programming and Scripting
HI,
cat test
abc
echo "def" >> test
output is
cat test
abc
def
the needed output is
cat test
abc def
and so on (5 Replies)
Discussion started by: jobycxa
5 Replies
3. Shell Programming and Scripting
Hello all
i know it is pretty hard one but you will manage it all
after noticing and calculating i find a rhythm for the file i want to edit
to copy the last 12 characters in line but the problem is to add after first 25 characters in same line
in other way too copy the last 12 characters... (10 Replies)
Discussion started by: princesasa
10 Replies
4. Shell Programming and Scripting
find the number of unique words in a file using sort com-
mand. (7 Replies)
Discussion started by: abhikamune
7 Replies
5. Homework & Coursework Questions
Hello, I tried to count all unique words of all files in one folder and its subfolders. Can anybody say me, why this doesnt work:
ls| find -d | cat | tr "\ " "\n"| uniq -u | wc -l
???
Cat writes only the names of those files, but not the wors, which should be in them.
Thanks for any advice.
... (9 Replies)
Discussion started by: Dworza
9 Replies
6. Shell Programming and Scripting
I am having a file with duplicate words how can I eliminate them
ant,bat
bat,cat
cat a.txt | grep -bat | awk '{print $1}'
expecting o/p as ant,bat,cat
How can I display the output as ant,bat,cat in a single line and no duplicates exists. (2 Replies)
Discussion started by: shikshavarma
2 Replies
7. Shell Programming and Scripting
Hi All
I have to search servers name say like 1000+ "unique names" line by line in child.txt files in another file that is a master file where all server present say "master.txt",if child.txt's server name matches with master files then it print yes else no with server name. (4 Replies)
Discussion started by: netdbaind
4 Replies
8. Shell Programming and Scripting
Hello,
I have a dictionary which I am building for the Open Source Community. The data structure is as under
HEADWORD=PARTOFSPEECH=ENGLISH MEANING
as shown in the example below
अ=m=Prefix signifying negation.
अँहँ=ind=Interjection expressing disapprobation.
अं=int=An interjection... (2 Replies)
Discussion started by: gimley
2 Replies
9. UNIX for Beginners Questions & Answers
Dear all,
I would like to know how to list and count unique words in thousands number of text files.
Please help me out
thanks in advance (9 Replies)
Discussion started by: imranrasheedamu
9 Replies
10. Shell Programming and Scripting
Hi All,
I need one help to replace particular words in file based on if finds another words in that file .
i.e.
my self is peter@king.
i am staying at north sydney.
we all are peter@king.
How to replace peter to sham if it finds @king in any line of that file.
Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies
LEARN ABOUT DEBIAN
javascript::minifier::xs
JavaScript::Minifier::XS(3pm) User Contributed Perl Documentation JavaScript::Minifier::XS(3pm)
NAME
JavaScript::Minifier::XS - XS based JavaScript minifier
SYNOPSIS
use JavaScript::Minifier::XS qw(minify);
$minified = minify($js);
DESCRIPTION
"JavaScript::Minifier::XS" is a JavaScript "minifier"; its designed to remove un-necessary whitespace and comments from JavaScript files,
which also not breaking the JavaScript.
"JavaScript::Minifier::XS" is similar in function to "JavaScript::Minifier", but is substantially faster as its written in XS and not just
pure Perl.
METHODS
minify($js)
Minifies the given $js, returning the minified JavaScript back to the caller.
HOW IT WORKS
"JavaScript::Minifier::XS" minifies the JavaScript by removing un-necessary whitespace from JavaScript documents. Comments (both block and
line) are also removed, except when (a) they contain the word "copyright" in them, or (b) they're needed to implement "IE Conditional
Compilation".
Internally, the minification process is done by taking multiple passes through the JavaScript document:
Pass 1: Tokenize
First, we go through and parse the JavaScript document into a series of tokens internally. The tokenizing process does not check to make
sure you've got syntactically valid JavaScript, it just breaks up the text into a stream of tokens suitable for processing by the
subsequent stages.
Pass 2: Collapse
We then march through the token list and collapse certain tokens down to their smallest possible representation. If they're still included
in the final results we only want to include them at their shortest.
Whitespace
Runs of multiple whitespace characters are reduced down to a single whitespace character. If the whitespace contains any "end of line"
(EOL) characters, then the end result is the first EOL character encountered. Otherwise, the result is the first whitespace character
in the run.
Pass 3: Pruning
We then go back through the token list and prune and remove un-necessary tokens.
Whitespace
Wherever possible, whitespace is removed; before+after comment blocks, and before+after various symbols/sigils.
Comments
Comments that are either (a) IE conditional compilation comments, or that (b) contain the word "copyright" in them are preserved. All
other comments (line and block) are removed.
Everything else
We keep everything else; identifiers, quoted literal strings, symbols/sigils, etc.
Pass 4: Re-assembly
Lastly, we go back through the token list and re-assemble it all back into a single JavaScript string, which is then returned back to the
caller.
AUTHOR
Graham TerMarsch (cpan@howlingfrog.com)
REPORTING BUGS
Please report bugs via RT (<http://rt.cpan.org/Dist/Display.html?Queue=JavaScript::Minifier::XS>), and be sure to include the JavaScript
that you're having troubles minifying.
COPYRIGHT
Copyright (C) 2007-2008, Graham TerMarsch. All Rights Reserved.
This is free software; you can redistribute it and/or modify it under the same license as Perl itself.
SEE ALSO
"JavaScript::Minifier".
perl v5.14.2 2011-11-15 JavaScript::Minifier::XS(3pm)