06-11-2009
How do I append a ^M to the end of each 129 character string
Hello all,
I have a stumper of a problem. I am trying to append a ^M or "newline" to the end of each 129 character string in a huge file in unix.
Each string starts with A00.
I am trying to get the file to go from...
A00vswjdv1 Test Junk Junk A00vswjdv2 Test Junk Junk A00vswjdv3 Test Junk Junk
to look like....
A00vswjdv1 Test Junk Junk
A00vswjdv2 Test Junk Junk
A00vswjdv3 Test Junk Junk
Any help is greatly appreciated.
BTW. I am on a AIX box.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
i want to append a character '|' at end of each line of a file abc.txt.
for example if the file abc.txt conatins:
a|b|c
1|2|33
w|2|11
i want result file xyz.txt
a|b|c|
1|2|33|
w|2|11|
I know this is simple but sumhow i am not able to reach end of line.
its urgent, thanks for... (4 Replies)
Discussion started by: muaz
4 Replies
2. UNIX for Dummies Questions & Answers
I have a comma delimited text file and need to appened ",000000" to the end of every line. For example:
Before:
"D700000","2006" ,"5000","Open Year" ,"Conversion" ,"Wk64","Productive Payroll $" ,1103.45
After:
"D700000","2006" ,"5000","Open Year" ,"Conversion" ,"Wk64","Productive Payroll... (3 Replies)
Discussion started by: bggibson
3 Replies
3. Shell Programming and Scripting
Hi, guys. I have one question:
I have a file called "group", the contents of it is below:
********************************
...
test:x:203:
sales:x:204:
repair:x:205:
research:x:206:brownj
...
***********
Now I want to add string ",sherrys" at the end of "research:x:206:brownj", so... (5 Replies)
Discussion started by: daikeyang
5 Replies
4. Shell Programming and Scripting
Hi Friends, I have a file with many lines as shown below.
/START SAMPLE LINE/
M:\mmarimut_v6.4.0_pit_01\java\build.xml@@\main\v6.4.0_pit_a
M:\mmarimut_v6.4.0_pit_01\port\Post.java@@\main\v6.4.0_pit_a
M:\mmarimut_v6.4.0_pit_01\switchview\View.java@@\main\v6.4.0_pit_a
/END SAMPLE LINE/
I... (1 Reply)
Discussion started by: nmattam
1 Replies
5. Shell Programming and Scripting
Hi friends,
I have a file containing many lines as follows.
M:\mmarimut_v6.4.0_pit_01\java\build.xml@@\main\v6.4.0_pit_a
M:\mmarimut_v6.4.0_pit_01\ADBasicView.java@@\main\v6.4.0_pit_a
I would like to append the string "\0" at the end of each line in the file. The output should look... (10 Replies)
Discussion started by: nmattam
10 Replies
6. Shell Programming and Scripting
I'm sure this is easy to do but I can't find a one line command with awk or sed to append a char to the end of the string from Nth column.
Any sugestion please?
Thanks (2 Replies)
Discussion started by: cabrao
2 Replies
7. Shell Programming and Scripting
Hello, could you please help with this one. I have an input file like this:
123,4567,89000
123456789,9876543,12
and for the output I need strings to be with the fixed length, let's say 15, and if the string is -lt 15 to be populated with blanks at the end until it reach 15, like this:
123 ,4567... (1 Reply)
Discussion started by: apenkov
1 Replies
8. Shell Programming and Scripting
I have 2 files that I am working with
$ cat file1
server1
server3
server5
server6
server8
$ cat file2
server1;Solaris;
server2; SLES;
server3;Linux;
server4; Solaris;
server5;SLES;
server6;SLES;
server7;Solaris;
server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies
9. Shell Programming and Scripting
Hi,
I have a File, which have multiple rows.
Like below
123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY
123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY
123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY
I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies
10. Shell Programming and Scripting
Platform: Solaris 10
I have a file like below
$ cat languages.txt
Spanish
Norwegian
English
Persian
German
Portugese
Chinese
Korean
Hindi
Malayalam
Bengali
Italian
Greek
Arabic
I want to append the string " is a great language" at end of each line in this file. (3 Replies)
Discussion started by: omega3
3 Replies
LEARN ABOUT DEBIAN
test::unit::assertion::coderef
Test::Unit::Assertion::CodeRef(3pm) User Contributed Perl Documentation Test::Unit::Assertion::CodeRef(3pm)
NAME
Test::Unit::Assertion::CodeRef - A delayed evaluation assertion using a Coderef
SYNOPSIS
require Test::Unit::Assertion::CodeRef;
my $assert_eq =
Test::Unit::Assertion::CodeRef->new(sub {
$_[0] eq $_[1]
or Test::Unit::Failure->throw(-text =>
"Expected '$_[0]', got '$_[1]'
");
});
$assert_eq->do_assertion('foo', 'bar');
Although this is how you'd use Test::Unit::Assertion::CodeRef directly, it is more usually used indirectly via Test::Unit::Test::assert,
which instantiates a Test::Unit::Assertion::CodeRef when passed a Coderef as its first argument.
IMPLEMENTS
Test::Unit::Assertion::CodeRef implements the Test::Unit::Assertion interface, which means it can be plugged into the Test::Unit::TestCase
and friends' "assert" method with no ill effects.
DESCRIPTION
This class is used by the framework to allow us to do assertions in a 'functional' manner. It is typically used generated automagically in
code like:
$self->assert(sub {
$_[0] == $_[1]
or $self->fail("Expected $_[0], got $_[1]");
}, 1, 2);
(Note that if Damian Conway's Perl6 RFC for currying ever comes to pass then we'll be able to do this as:
$self->assert(^1 == ^2 || $self->fail("Expected ^1, got ^2"), 1, 2)
which will be nice...)
If you have a working B::Deparse installed with your perl installation then, if an assertion fails, you'll see a listing of the decompiled
coderef (which will be sadly devoid of comments, but should still be useful)
AUTHOR
Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
o Test::Unit::TestCase
o Test::Unit::Assertion
perl v5.8.8 2006-09-13 Test::Unit::Assertion::CodeRef(3pm)