Free webspace:Free ad-supported web hosting! 1GB of storage, network and FTP access, easy blogging tools as well as more!
Free of charge:1 GB of networked storageUnlimited bandwidthBlog BuildingUnlimited FTP AccessOnline File ManagerWebsite
Can be done using find with sed or perl.
To find the current directory,
The code is as follows
Copy Code
Replace into
The code is as follows
Copy Code
Find./-type f-exec sed-i "S//
Occasionally write Perl script, with Eclipse open too slow, NotePad bar, color is too monotonous, notepad++ no doubt is not a good choice, but when you want to enter Chinese comments, often jam very uncomfortable, and finally choose to use EditPlus,
When you create an array in Perl, you can use the QW.
But there is a problem, if you want to create an array of 20 names, and everyone's name is this form of "Join Smith" "Harry Potter" which means that each name contains both a surname and a name.
I'm doing something with Perl+mdbm+spread recently.
PHP has been used for a long time, Python and Ruby have been used, the classic scripting language has not been touched by Perl, now in the same way as a pupil holding a textbook gnawing.
It's a
1. Remove duplicate elements from an array:
Using the GREP function code fragment:Code:
Copy Code code as follows:
My @array = (' A ', ' B ', ' C ', ' a ', ' d ', 1, 2, 5, 1, 5);
My%count;
My @uniq_times = grep {+ + $count {$_}
The main use is to find the related files in the/proc directory.
#!/usr/bin/perl use
strict;
Use warnings;
#usage: process_grep.pl processname
exit (Main (@ARGV));
Sub Main {my
$Phash;
my $ProcessName = shift;
My $PROC _dir = "/proc";
My first Perl script for the production environment, though not very good, has taken a solid step:)Leaders have tasks, to a number of IP list, ping each machine, if there is no response to send an email notification, the message needs to separate,
A conversion program that simply converts a A in the DNA sequence to T, the first of which does not use a private variable.
Copy Code code as follows:
#!/bin/perl
#下面是一段DNA序列
$DNA =attatatat; #这里是我们的序列
$result =a_to_t ($DNA);
The scalar quantity (Varibale) begins with the dollar sign ($), which also becomes the magic symbol (SIGIL). Perl uses a magic character to differentiate what type of variable it is.
Most of the variable names in Perl are used in all lowercase .
Perl installation module can use the CPAN command, but usually we do not have root user rights, so we can only install the module in sudo mode.For example, to install the Net::scp::expect module,Execute cpan net::scp::expectThe first use of the CPAN
According to Beginning Perl book published by Tsinghua Pub., the list context appears when you were trying to Assi GN Some value to a list variable.1 my @copy @source;This was a very simple instance of shallow copy, which usually means you just
Summary:1. Using built-in warning information2. Using the Perl Help documentDetails:1. Built-in warning information-Perl can warn you when there are "suspicious things" running in your program-The warning does not change the behavior of the program,
The first time I installed VM tools in Fedora, I encountered this problem, and now I would like to share my solution with you, hoping to help you! problem: After extracting the compressed package from VM tools, I execute it under
1 Please use Perl on the screen output Hello,world[email protected] perl]# cat perlhello.pl #!/usr/bin/perlprint "hello,world!\n"; [Email protected] perl]#/perlhello.pl hello,world!2 intercept regular matches, and in the shell, it's a big
The use strict consists of 3 parts. One of them (use strict "subs") is responsible for prohibiting the indiscriminate of the naked word . What does that mean?Without this restriction, the following code can also print "Hello".My $x = hello;print "$x
I,Regular ExpressionSpecialVariable:1. $ N: contains the nth substring of the last pattern match.2. $ &: String matched in the previous successful mode3. $ ': Content Before the successful substring4. $ ': content after the child string that was
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.