04-04-2006
Thanks! You are right. So I am fraid of violating rules again. But the basic idea is,
H82421 RDH11
H82421 DKFZP564M1462
H82435 BAGE4
H82435 MLL3
H82527 C20orf17
H82532 -
H82706 ID2
H82801 -
H82812 TNRC6B
H82872 UACA
What I need,
H82421 RDH11 /// DKFZP564M1462
H82435 BAGE4 /// MLL3
H82527 C20orf17
H82532 -
H82706 ID2
H82801 -
H82812 TNRC6B
H82872 UACA
Your code gave the line break in between $2,
H82421 RDH11^M /// DKFZP564M1462
H82435 BAGE4^M /// MLL3
H82527 C20orf17
H82532 -
H82706 ID2
H82801 -
H82812 TNRC6B
H82872 UACA
I could use some text editor to remove line breaks, but thought the complete code could be helpful for other people too. In addition, if the redundent lines are not sorted, what code should be? Thanks so much.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
I've searched the web and this forum for this but not had any luck. I'm trying to use sed so when it finds a space it will insert a new line.
What i have is a file containing .e.g
1 2 4 7 9
and want it to look like
1
2
4
7
9
I've tried:
more test2 | sed 's/ /\\n/g'... (1 Reply)
Discussion started by: Cordially
1 Replies
2. Shell Programming and Scripting
Hi all!
I have a problem with line command. The aim is to write each line of stdin into a text file.
For example with this command:
$find /
/usr/share/zoneinfo/WET
/usr/share/zoneinfo/Zulu
/usr/share/zoneinfo/iso3166.tab
/usr/share/zoneinfo/localtime
/usr/share/zoneinfo/zone.tab... (3 Replies)
Discussion started by: victorin
3 Replies
3. Shell Programming and Scripting
Hi everyone. I realise this is probably a bit of a noob question, but I'm actually a C# developer working on a legacy system, and can't remember much unix.
I want to read from a pipe-delimeted file like formatted thusly:
idno|PRODUCT|Name|street town postcode|etc|etc|etc|etc... (4 Replies)
Discussion started by: Darkness Fish
4 Replies
4. Shell Programming and Scripting
At first, give my best wish for all MOD and admins here. I"m learning bash shell program just for a month, not too much, not too little, but i must admire that i'm very bad at math and algorithm. :(
I want to do this :
Read the content of a file line by line and at each line, ask me want to... (3 Replies)
Discussion started by: madi3d8
3 Replies
5. Shell Programming and Scripting
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies
6. Shell Programming and Scripting
Hi everybody, I am new to shell script. Please help me with this problem.
I have a file test.txt with the content like this:
I have a shell script test.sh like this
#!/bin/sh
while read line
do
echo $line >> out.txt
done < test.txt
out.txt is expected to have the same content... (10 Replies)
Discussion started by: Dark2Bright
10 Replies
7. Shell Programming and Scripting
hi ,
i need to check the first line of a tilde(~) delimitted source file, so i wrote a command as follows
head -1 <source filename>
but the problem is that the line is too lengthy,as it spans out of the window,so im not able to see the line till end.can anybody please suggest a workaround... (2 Replies)
Discussion started by: angel12345
2 Replies
8. Shell Programming and Scripting
Hi folks,
I've list of LDAP records in this format:
cat cmmac.export.tmp2
dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc
cmmac: 00:13:11:36:a5:06
dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc
cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies
9. Shell Programming and Scripting
Hi All,
Please can you advise/help on the below issue
i did a bcp out of a table, it is having problem of line break such that one line is getting broken in two lines for many records.
eg
Correct format
Line 1: - 000f00000bfe2c2c 000218310300000000GBP GBP 734654 10970.35 ... (3 Replies)
Discussion started by: mad_man12
3 Replies
10. UNIX for Dummies Questions & Answers
i have a file like below
New_file.txt
123|345|ab cd|ef gh
345|456|jk hu|uyh
My script is
#!/bin/ksh
set -x
for line in `cat New_file.txt`
do
a1=`echo $line|cut -d '|' -f1`
echo $a1
done
output
++ cat New_file.txt (2 Replies)
Discussion started by: Rajesh_us
2 Replies
LEARN ABOUT OSX
mail::dkim::textwrap
Mail::DKIM::TextWrap(3) User Contributed Perl Documentation Mail::DKIM::TextWrap(3)
NAME
Mail::DKIM::TextWrap - text wrapping module written for use with DKIM
SYNOPSIS (FOR MAIL::DKIM USERS)
use Mail::DKIM::TextWrap;
Just add the above line to any program that uses Mail::DKIM::Signer and your signatures will automatically be wrapped to 72 characters.
SYNOPSIS (FOR OTHER USERS)
my $output = "";
my $tw = Mail::DKIM::TextWrap->new(
Margin => 10,
Output => $output,
);
$tw->add("Mary had a little lamb, whose fleece was white as snow.
");
$tw->finish;
print $output;
DESCRIPTION
This is a general-purpose text-wrapping module that I wrote because I had some specific needs with Mail::DKIM that none of the contemporary
text-wrapping modules offered.
Specifically, it offers the ability to change wrapping options in the middle of a paragraph. For instance, with a DKIM signature:
DKIM-Signature: a=rsa; c=simple; h=first:second:third:fourth;
b=Xr2mo2wmb1LZBwmEJElIPezal7wQQkRQ8WZtxpofkNmXTjXf8y2f0
the line-breaks can be inserted next to any of the colons of the h= tag, or any character of the b= tag. The way I implemented this was to
serialize the signature one element at a time, changing the text-wrapping options at the start and end of each tag.
TEXT WRAPPING OPTIONS
Text wrapping options can be specified when calling new(), or by simply changing the property as needed. For example, to change the number
of characters allowed per line:
$tw->{Margin} = 20;
Break
a regular expression matching characters where a line break can be inserted. Line breaks are inserted AFTER a matching substring. The
default is "/s/".
BreakBefore
a regular expression matching characters where a line break can be inserted. Line breaks are inserted BEFORE a matching substring.
Usually, you want to use Break, rather than BreakBefore. The default is "undef".
Margin
specifies how many characters to allow per line. The default is 72. If no place to line-break is found on a line, the line will extend
beyond this margin.
Separator
the text to insert when a linebreak is needed. The default is "
". If you want to set a following-line indent (e.g. all lines but the
first begin with four spaces), use something like "
".
Swallow
a regular expression matching characters that can be omitted when a line break occurs. For example, if you insert a line break between
two words, then you are replacing a "space" with the line break, so you are omitting the space. On the other hand, if you insert a line
break between two parts of a hyphenated word, then you are breaking at the hyphen, but you still want to display the hyphen. The
default is "/s/".
CONSTRUCTOR
new() - create a new text-wrapping object
my $tw = Mail::DKIM::TextWrap->new(
Output => $output,
%wrapping_options,
);
The text-wrapping object encapsulates the current options and the current state of the text stream. In addition to specifying text wrapping
options as described in the section above, the following options are recognized:
Output
a scalar reference, or a glob reference, to specify where the "wrapped" text gets output to. If not specified, the default of STDOUT is
used.
METHODS
add() - process some text that can be wrapped
$tw->add("Mary had a little lamb.
");
You can add() all the text at once, or add() the text in parts by calling add() multiple times.
finish() - call when no more text is to be added
$tw->finish;
Call this when finished adding text, so that any remaining text in TextWrap's buffers will be output.
flush() - output the current partial word, if any
$tw->flush;
Call this whenever changing TextWrap's parameters in the middle of a string of words. It explicitly allows a line-break at the current
position in the string, regardless of whether it matches the current break pattern.
perl v5.16.2 2010-02-28 Mail::DKIM::TextWrap(3)