3
votes
2answers
515 views

How to comment out multiple line matching a regex using sed or awk

I have a file that contains this: [...] location /static { ... multiple lines ... } [...] location /static/ { ... multiple lines ... } [...] And I want to get: [...] # ...
0
votes
2answers
39 views

Where to place an executable Perl script?

I'm now planning a solution that has to call a script that's running on a Linux \UNIX host. I'd prefer to place that script in a folder that exists in all kinds of Linux and UNIX. This helps me to ...
0
votes
2answers
319 views

Regex for unix paths

What would be the correct perl regex for detecting only Unix paths? ./dir1/dir2/file.ext - invalid ./dir1/dir2/ - valid ./dir1/dir2 - valid
3
votes
1answer
478 views

How to run a Perl script in a Unix environment from Windows?

A little background: I am trying to interact with data I have saved in Perl files using a program I wrote in C using the Win32 API. The C program is in Windows and the Perl files are accessed ...
1
vote
1answer
124 views

Keeping a Perl script from automatically terminating in terminal

I'm trying to create a shortcut of sorts to a Perl script, by saving a terminal command which launches the script to a .command file. The script is interactive, and allows for the user to interface ...
3
votes
3answers
1k views

How to edit the header of a huge CSV file in-place?

I have several huge CSV files in which I want to swap two column names. I do not want to modify/copy/rewrite the data. The operation is very cheap in C: fopen the file, fgets the header, fseek or ...
1
vote
3answers
2k views

Perl command not found

I am new to Unix. I am trying to Run a Perl script on Fedora 14 machine. I wrote the script and saved it in a file called PerlOne.pl and changed its permission to 755. This is what it has ...
7
votes
6answers
5k 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 ...
0
votes
2answers
603 views

egrep: CPU and memory usage

My Linux machine has 16 processors and free memory of 70 GB but when I run an egrep command, the command is using (checked through the top command) 100% of CPU and 0.5 of memory: 22391 aime 25 ...
0
votes
1answer
235 views

Use “find” command to list files IN specified directory

I'm putting together a perl script, and I'm using the following command to list all files and directories under a specified directory `find $dir -print` This lists all files and directories UNDER ...
3
votes
3answers
490 views

Creating UNIX-style shortcuts on Windows?

I have a unique problem... I develop Perl on a Windows machine, but my test/prod servers are AIX. I want to be able to test locally with an installation of Apache & Perl, but I don't want to have ...
5
votes
4answers
883 views

How to rename files in batch with Unix rename command?

I have files whose names look like this: Sim1-2_40.36.chr20_sb.foo.indel.novoalign.sam Sim1-2_40.36.chr20_sb.foo.indel.bwa.sam What I want to do is to replace all indel with snp in the names ...