WestCoastProjects
WestCoastProjects

Reputation: 63172

Specifying single space delimiter in perl

The following -F\\s specifies any whitespace as a field delimiter for perl

$head simhash.txt | perl -F\\s  -lane  'print $F[1]'

FRM_REL2
..

What is the way to specify only a space (e.g. not tab or other whitespace) as the delimiter?

Upvotes: 0

Views: 118

Answers (1)

Mike.pm
Mike.pm

Reputation: 159

"You can't use literal whitespace in the pattern." (perldoc perlrun).

So you have to use another notations, hexadecimal for example:

head simhash.txt | perl -F/\\x20/ -lane 'print $F[1]'

Upvotes: 5

Related Questions