01-31-2014
Craaaaaap. I think I had this on my own but was bitten by a trip through an editor that changed the line endings. So, takeaway for my internet self when I search for this again.
1) Yoda was right! Thanks for the help!
2) Self, it might not be your code but the input. Maybe create your test files before making them up to ask for help...
3) LF line endings vs CR line endings matter, and seem to be what broke this for you. (LF is what you needed and what seems to fix it.)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
having a file as follows
MediaErr.log
84 Server1 Policy1 Schedule1 master1 05/08/2008 02:12:16
84 Server1 Policy1 Schedule1 master1 05/08/2008 02:22:47
84 Server1 Policy1 Schedule1 master1 05/08/2008 03:41:26
84 Server1 Policy1 ... (1 Reply)
Discussion started by: karthikn7974
1 Replies
2. Shell Programming and Scripting
Hi guys,
Please guide for Solution.
PART-I
INPUT FILE (has 2 columns ID and score)
TC5584_1 93.9
DV161411_2 79.5
BP132435_5 46.8
EB682112_1 34.7
BP132435_4 29.5
TC13860_2 10.1
OUTPUT FILE (It shudn't contain the line ' BP132435_4 29.5 ' as BP132435 is repeated... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies
3. Shell Programming and Scripting
So, this issue is driving me nuts! I was hoping to get a lending hand here...
I have 2 files:
file1.txt contains:
this is example1
this is example2
this is example3
this is example4
this is example5
file2.txt contains:
example3
example5
Basically, I need a script or command to... (4 Replies)
Discussion started by: bashshadow1979
4 Replies
4. Shell Programming and Scripting
Hi,
I need to remove some lines from an XML file is the value within a tag is empty.
Imagine this scenario,
<acd><acdID>2</acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
I... (3 Replies)
Discussion started by: giles.cardew
3 Replies
5. UNIX for Dummies Questions & Answers
hello all,
I have an input file with four columns like this with a lot of lines
and for example, line 1 and line 5 match because the first 4 characters match and the fourth column matches too. I want to keep the line that has the lowest number in the third column. So I discard line 5.... (5 Replies)
Discussion started by: TheTransporter
5 Replies
6. Shell Programming and Scripting
Hi All,
I just need a quick fix here. I need to delete all lines containing "." in the 6th column.
Input:
1 1055498 . G T 5.46 .
1 1902377 . C T 7.80 .
1 1031540 . A G 34.01 PASS
1 ... (2 Replies)
Discussion started by: Hkins552
2 Replies
7. Shell Programming and Scripting
I have a csv file that I would like to remove duplicate lines based on field 1 and sort. I don't care about any of the other fields but I still wanna keep there data intact. I was thinking I could do something like this but I have no idea how to print the full line with this. Please show any method... (8 Replies)
Discussion started by: cokedude
8 Replies
8. Shell Programming and Scripting
Hi, I have multiple large files which consist of the below format:
I am trying to write an awk or sed script to remove all occurrences of the 00 record except the first and remove all of the 80 records except the last one.
Any help would be greatly appreciated. (10 Replies)
Discussion started by: nwalsh88
10 Replies
9. UNIX for Dummies Questions & Answers
Gurus,
I am relatively new to Unix scripting and am struck with a problem in my script. I have positional input file which has a FLAG indicator in at position 11 in every record of the file.
If the Flag has value =Y, then the record from the input needs to be written to a new file.However if... (3 Replies)
Discussion started by: gsam
3 Replies
10. Shell Programming and Scripting
Dear community,
I have to remove duplicate lines from a file contains a very big ammount of rows (milions?) based on 1st and 3rd columns
The data are like this:
Region 23/11/2014 09:11:36 41752
Medio 23/11/2014 03:11:38 4132
Info 23/11/2014 05:11:09 4323... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
LEARN ABOUT CENTOS
test::eol
Test::EOL(3) User Contributed Perl Documentation Test::EOL(3)
NAME
Test::EOL - Check the correct line endings in your project
SYNOPSIS
"Test::EOL" lets you check for the presence of trailing whitespace and/or windows line endings in your perl code. It reports its results in
standard "Test::Simple" fashion:
use Test::EOL tests => 1;
eol_unix_ok( 'lib/Module.pm', 'Module is ^M free');
and to add checks for trailing whitespace:
use Test::EOL tests => 1;
eol_unix_ok( 'lib/Module.pm', 'Module is ^M and trailing whitespace free', { trailing_whitespace => 1 });
Module authors can include the following in a t/eol.t and have "Test::EOL" automatically find and check all perl files in a module
distribution:
use Test::EOL;
all_perl_files_ok();
or
use Test::EOL;
all_perl_files_ok( @mydirs );
and if authors would like to check for trailing whitespace:
use Test::EOL;
all_perl_files_ok({ trailing_whitespace => 1 });
or
use Test::EOL;
all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs );
DESCRIPTION
This module scans your project/distribution for any perl files (scripts, modules, etc) for the presence of windows line endings.
FUNCTIONS
all_perl_files_ok
all_perl_files_ok( [ \%options ], [ @directories ] )
Applies "eol_unix_ok()" to all perl files found in @directories (and sub directories). If no <@directories> is given, the starting point is
one level above the current running script, that should cover all the files of a typical CPAN distribution. A perl file is *.pl or *.pm or
*.t or a file starting with "#!...perl"
Valid "\%options" currently are:
o trailing_whitespace
By default Test::EOL only looks for Windows (CR/LF) line-endings. Set this to true to raise errors if any kind of trailing whitespace
is present in the file.
o all_reasons
Normally Test::EOL reports only the first error in every file (given that a text file originated on Windows will fail every single
line). Set this a true value to register a test failure for every line with an error.
If the test plan is defined:
use Test::EOL tests => 3;
all_perl_files_ok();
the total number of files tested must be specified.
eol_unix_ok
eol_unix_ok ( $file [, $text] [, \%options ] )
Run a unix EOL check on $file. For a module, the path (lib/My/Module.pm) or the name (My::Module) can be both used. $text is the diagnostic
label emited after the "ok"/"not ok" TAP output. "\%options" takes the same values as described in "all_perl_files_ok".
EXPORT
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented
module.
ACKNOWLEDGEMENTS
Shamelessly ripped off from Test::NoTabs.
SEE ALSO
Test::More, Test::Pod. Test::Distribution, <Test:NoWarnings>, Test::NoTabs, Module::Install::AuthorTests.
AUTHORS
o Arthur Axel 'fREW' Schmidt <frioux@gmail.com>
o Florian Ragwitz <rafl@debian.org>
o Kent Fredric <kentfredric@gmail.com>
o Peter Rabbitson <ribasushi@cpan.org>
o Tomas Doran <bobtfish@bobtfish.net>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Tomas Doran.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.16.3 2012-06-15 Test::EOL(3)