Skip to main content

Questions tagged [perl]

Perl is a powerful, high level programming language. Questions about Perl should be limited to the Perl development environment, running Perl, or using Perl to automate tasks on your computer.

194 votes
18 answers
162k views

Removing ANSI color codes from text stream

Examining the output from perl -e 'use Term::ANSIColor; print color "white"; print "ABC\n"; print color "reset";' in a text editor (e.g., vi) shows the following: ^[[37mABC ^[[0m How would one ...
user001's user avatar
  • 3,714
85 votes
11 answers
99k views

When to use Bash and when to use Perl/Python/Ruby? [closed]

We are doing all our scripting with Bash so far, but I'm starting to feel a bit silly about it. While we can of course do everything we want with Bash (it's quite powerful), I'm starting to wonder if ...
futlib's user avatar
  • 1,279
36 votes
5 answers
55k views

How to cut a file to a given size under Linux?

I want to shrink a file's size by brute-force, that is, I don't care about the rest, I just want to cut the file, say by half, and discard the rest. The first thing that comes to mind is Perl's ...
xpt's user avatar
  • 8,851
34 votes
12 answers
5k views

How do I remove a file in Linux whose name looks like it's ONLY a hyphen, as in "-"

I've tried rm -- - rm "-" rm "\-" rm \- Gave Perl a shot ~$ perl -e '$junk = glob("-"); chomp $junk; print "$junk\n"; `rm $junk`;' - rm: cannot remove `-': No such file or directory ...and... ~$ ...
jgrundstad's user avatar
29 votes
5 answers
12k views

Can I use perl regular expressions in the vim command line?

I want to use perl regular expressions on the vim command line. For example, to capitalize the words on the current line, you could type: :s/(\w+)/\u$1/g
user51549's user avatar
  • 391
23 votes
3 answers
6k views

Command vs program?

I was looking up the difference between adduser and useradd, and an explanation is that useradd is a command while adduser is a perl script. I understand what a perl script is, but what I do not ...
kramer65's user avatar
  • 1,424
19 votes
8 answers
27k views

How do I queue multiple files for copying on a Mac?

When I copy multiple files on a Mac, the system tries to copy them all at the same time. The problem is two-fold. First of all, when you select multiple files and copy them, they all go into one ...
Kebman's user avatar
  • 515
18 votes
7 answers
22k views

unix - split a huge .gz file by line

I'm sure someone has had the below need, what is a quick way of splitting a huge .gz file by line? The underlying text file has 120million rows. I don't have enough disk space to gunzip the entire ...
toop's user avatar
  • 365
14 votes
2 answers
23k views

How can I identify non-ASCII characters from the shell?

Is there a simple way to print all non-ASCII characters and the line numbers on which they occur in a file using a command line utility such as grep, awk, perl, etc? I want to change the encoding of ...
user001's user avatar
  • 3,714
13 votes
3 answers
33k views

Getting the process id for current perl script

How do I get the process id for the perl process that's running the current script? getppid() doesn't return the same pid as ps -ea| grep . Is there is an easy way or do I just run the ps -ea command ...
ageis23's user avatar
  • 671
10 votes
7 answers
43k views

How to convert .xlsx to .txt?

I want to know if there is a Linux tool or a script available to convert .xlsx file to .txt.
user53032's user avatar
  • 101
10 votes
1 answer
30k views

Perl for matching with regular expressions in Terminal?

I'm trying to familiarize myself a little with Perl to use for regular expression searches in Terminal (Mac). Now, I'm not really looking to learn Perl rigourously, just trying to find out how to do ...
Anders Svensson's user avatar
10 votes
1 answer
21k views

Counting occurrences in first column of a file

We have this file: 1 2 1 3 1 2 3 3 52 1 52 300 and 1000 more. I want to count the number of times each value occurs in the first column. 1 3 3 1 52 2 This means we saw 1 three times. How can ...
Arash's user avatar
  • 726
9 votes
3 answers
78k views

How to execute a PL file in Linux?

I have a vmware-install.pl file that I need to execute. I double click it but Linux will open it in a text editor for editing. How to execute this file? Can it be done from GUI? In file's properties ...
IceCold's user avatar
  • 2,111
8 votes
2 answers
17k views

gcc not finding header file though its path has been included with -I

I'm trying to install a module (Package::Stash::XS) via cpanm, but the installation is failing due to a gcc error. The command: gcc -c -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing ...
Sundar R's user avatar
  • 1,489

15 30 50 per page
1
2 3 4 5
34