How to delete line if longer than XY?
up vote
17
down vote
favorite
How can i delete a line if it is longer than e.g.: 2048 chars?
sed
add a comment |
up vote
17
down vote
favorite
How can i delete a line if it is longer than e.g.: 2048 chars?
sed
Do you insist on using sed? This is easy, for example in python. And no doubt even easier in perl. Though the question is not terribly well defined. Copy a file, removing all lines longer than 2048, or something else?
– Faheem Mitha
Mar 23 '11 at 18:21
add a comment |
up vote
17
down vote
favorite
up vote
17
down vote
favorite
How can i delete a line if it is longer than e.g.: 2048 chars?
sed
How can i delete a line if it is longer than e.g.: 2048 chars?
sed
sed
edited Jan 29 '14 at 17:27
jlliagre
46.1k783132
46.1k783132
asked Mar 23 '11 at 18:09
LanceBaynes
10.2k75192322
10.2k75192322
Do you insist on using sed? This is easy, for example in python. And no doubt even easier in perl. Though the question is not terribly well defined. Copy a file, removing all lines longer than 2048, or something else?
– Faheem Mitha
Mar 23 '11 at 18:21
add a comment |
Do you insist on using sed? This is easy, for example in python. And no doubt even easier in perl. Though the question is not terribly well defined. Copy a file, removing all lines longer than 2048, or something else?
– Faheem Mitha
Mar 23 '11 at 18:21
Do you insist on using sed? This is easy, for example in python. And no doubt even easier in perl. Though the question is not terribly well defined. Copy a file, removing all lines longer than 2048, or something else?
– Faheem Mitha
Mar 23 '11 at 18:21
Do you insist on using sed? This is easy, for example in python. And no doubt even easier in perl. Though the question is not terribly well defined. Copy a file, removing all lines longer than 2048, or something else?
– Faheem Mitha
Mar 23 '11 at 18:21
add a comment |
6 Answers
6
active
oldest
votes
up vote
19
down vote
accepted
sed '/^.{2048}./d' input.txt > output.txt
2
I get the error messagesed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
add a comment |
up vote
6
down vote
Here's a solution which deletes lines that has 2049 or more characters:
sed -E '/^.{2049}/d' <file.in >file.out
Strictly speaking, the ^
anchor is not needed.
With awk
, printing lines of length 2048 or shorter:
awk 'length <= 2048' <file.in >file.out
1
I get the error messagesed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
add a comment |
up vote
2
down vote
Something like this should work in Python.
of = open("orig")
nf = open("new",'w')
for line in of:
if len(line) < 2048:
nf.write(line)
of.close()
nf.close()
1
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
add a comment |
up vote
1
down vote
perl -lne "length < 2048 && print" infile > outfile
+1 The-l
isn't needed, though.
– Joseph R.
Jan 29 '14 at 17:22
Does not work for me. Perl v5.16.2.Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
You may trylength($_) > 2048 && print
.length
is a shortcut forlength($_)
anyway.
– MaratC
Nov 17 '14 at 12:10
add a comment |
up vote
0
down vote
The above answers do not work for me on Mac OS X 10.9.5.
The following code does work:
sed '/.{2048}/d'
.
Although not asked, but provided for reference, the reverse can be achieved the following code:
sed '/.{2048}/!d'
.
lol, butsed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)
– alex gray
Jul 24 '15 at 13:29
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
add a comment |
up vote
0
down vote
With gnu-sed, you may use the -r flag, to avoid typing the backslashes, and a comma, to define an open interval:
sed -r "/.{2049,}/d" input.txt > output.txt
with:
- x{2049} meaning exactly 2049 xs
- x{2049,3072} meaning from 2049 to 3072 xs
- x{2049,} meaning at least 2049 xs
- x{,2049} meaning at most 2049 xs
For the intervals, to not match bigger patterns, you would need line anchors like
sed -r "/^.{32,64}$/d" input.txt > output.txt
add a comment |
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
19
down vote
accepted
sed '/^.{2048}./d' input.txt > output.txt
2
I get the error messagesed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
add a comment |
up vote
19
down vote
accepted
sed '/^.{2048}./d' input.txt > output.txt
2
I get the error messagesed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
add a comment |
up vote
19
down vote
accepted
up vote
19
down vote
accepted
sed '/^.{2048}./d' input.txt > output.txt
sed '/^.{2048}./d' input.txt > output.txt
edited Nov 1 '16 at 0:43
Wildcard
22.5k960164
22.5k960164
answered Mar 23 '11 at 18:26
forcefsck
5,6061931
5,6061931
2
I get the error messagesed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
add a comment |
2
I get the error messagesed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
2
2
I get the error message
sed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)– wedi
Oct 13 '14 at 15:47
I get the error message
sed: 1: "/^.{2048}..*/d": RE error: invalid repetition count(s)
(Mac OS X)– wedi
Oct 13 '14 at 15:47
1
1
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
@wedi you probably want to install the GNU version instead of the BSD version that ships with Mac. This is easy with brew
– Freedom_Ben
Jul 6 '16 at 0:00
add a comment |
up vote
6
down vote
Here's a solution which deletes lines that has 2049 or more characters:
sed -E '/^.{2049}/d' <file.in >file.out
Strictly speaking, the ^
anchor is not needed.
With awk
, printing lines of length 2048 or shorter:
awk 'length <= 2048' <file.in >file.out
1
I get the error messagesed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
add a comment |
up vote
6
down vote
Here's a solution which deletes lines that has 2049 or more characters:
sed -E '/^.{2049}/d' <file.in >file.out
Strictly speaking, the ^
anchor is not needed.
With awk
, printing lines of length 2048 or shorter:
awk 'length <= 2048' <file.in >file.out
1
I get the error messagesed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
add a comment |
up vote
6
down vote
up vote
6
down vote
Here's a solution which deletes lines that has 2049 or more characters:
sed -E '/^.{2049}/d' <file.in >file.out
Strictly speaking, the ^
anchor is not needed.
With awk
, printing lines of length 2048 or shorter:
awk 'length <= 2048' <file.in >file.out
Here's a solution which deletes lines that has 2049 or more characters:
sed -E '/^.{2049}/d' <file.in >file.out
Strictly speaking, the ^
anchor is not needed.
With awk
, printing lines of length 2048 or shorter:
awk 'length <= 2048' <file.in >file.out
edited Nov 29 at 23:19
answered Sep 7 '11 at 10:13
Kusalananda
118k16223363
118k16223363
1
I get the error messagesed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
add a comment |
1
I get the error messagesed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)
– wedi
Oct 13 '14 at 15:47
1
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
1
1
I get the error message
sed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)– wedi
Oct 13 '14 at 15:47
I get the error message
sed: 1: "/^.{400,}$/d": RE error: invalid repetition count(s)
(Mac OS X)– wedi
Oct 13 '14 at 15:47
1
1
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
@wedi Now updated and tested on macOS Mojave.
– Kusalananda
Nov 29 at 23:20
add a comment |
up vote
2
down vote
Something like this should work in Python.
of = open("orig")
nf = open("new",'w')
for line in of:
if len(line) < 2048:
nf.write(line)
of.close()
nf.close()
1
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
add a comment |
up vote
2
down vote
Something like this should work in Python.
of = open("orig")
nf = open("new",'w')
for line in of:
if len(line) < 2048:
nf.write(line)
of.close()
nf.close()
1
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
add a comment |
up vote
2
down vote
up vote
2
down vote
Something like this should work in Python.
of = open("orig")
nf = open("new",'w')
for line in of:
if len(line) < 2048:
nf.write(line)
of.close()
nf.close()
Something like this should work in Python.
of = open("orig")
nf = open("new",'w')
for line in of:
if len(line) < 2048:
nf.write(line)
of.close()
nf.close()
answered Mar 23 '11 at 18:33
Faheem Mitha
22.6k1879134
22.6k1879134
1
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
add a comment |
1
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
1
1
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
Personally, @Faheem, I prefer your answer. The reason why is that it was very easy for me to turn it around into 'delete all lines smaller than x'. I don't use Python all the time, but when I do I always feel I should learn it well.
– ixtmixilix
May 22 '11 at 18:18
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
@ixtmixilix: Yes, using a full featured language like Python is pretty flexible. Thanks for the comment.
– Faheem Mitha
May 24 '11 at 16:46
add a comment |
up vote
1
down vote
perl -lne "length < 2048 && print" infile > outfile
+1 The-l
isn't needed, though.
– Joseph R.
Jan 29 '14 at 17:22
Does not work for me. Perl v5.16.2.Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
You may trylength($_) > 2048 && print
.length
is a shortcut forlength($_)
anyway.
– MaratC
Nov 17 '14 at 12:10
add a comment |
up vote
1
down vote
perl -lne "length < 2048 && print" infile > outfile
+1 The-l
isn't needed, though.
– Joseph R.
Jan 29 '14 at 17:22
Does not work for me. Perl v5.16.2.Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
You may trylength($_) > 2048 && print
.length
is a shortcut forlength($_)
anyway.
– MaratC
Nov 17 '14 at 12:10
add a comment |
up vote
1
down vote
up vote
1
down vote
perl -lne "length < 2048 && print" infile > outfile
perl -lne "length < 2048 && print" infile > outfile
answered Jan 29 '14 at 17:14
MaratC
1111
1111
+1 The-l
isn't needed, though.
– Joseph R.
Jan 29 '14 at 17:22
Does not work for me. Perl v5.16.2.Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
You may trylength($_) > 2048 && print
.length
is a shortcut forlength($_)
anyway.
– MaratC
Nov 17 '14 at 12:10
add a comment |
+1 The-l
isn't needed, though.
– Joseph R.
Jan 29 '14 at 17:22
Does not work for me. Perl v5.16.2.Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
You may trylength($_) > 2048 && print
.length
is a shortcut forlength($_)
anyway.
– MaratC
Nov 17 '14 at 12:10
+1 The
-l
isn't needed, though.– Joseph R.
Jan 29 '14 at 17:22
+1 The
-l
isn't needed, though.– Joseph R.
Jan 29 '14 at 17:22
Does not work for me. Perl v5.16.2.
Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
Does not work for me. Perl v5.16.2.
Warning: Use of "length" without parentheses is ambiguous at -e line 1. Unterminated <> operator at -e line 1.
– wedi
Oct 13 '14 at 15:51
You may try
length($_) > 2048 && print
. length
is a shortcut for length($_)
anyway.– MaratC
Nov 17 '14 at 12:10
You may try
length($_) > 2048 && print
. length
is a shortcut for length($_)
anyway.– MaratC
Nov 17 '14 at 12:10
add a comment |
up vote
0
down vote
The above answers do not work for me on Mac OS X 10.9.5.
The following code does work:
sed '/.{2048}/d'
.
Although not asked, but provided for reference, the reverse can be achieved the following code:
sed '/.{2048}/!d'
.
lol, butsed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)
– alex gray
Jul 24 '15 at 13:29
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
add a comment |
up vote
0
down vote
The above answers do not work for me on Mac OS X 10.9.5.
The following code does work:
sed '/.{2048}/d'
.
Although not asked, but provided for reference, the reverse can be achieved the following code:
sed '/.{2048}/!d'
.
lol, butsed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)
– alex gray
Jul 24 '15 at 13:29
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
add a comment |
up vote
0
down vote
up vote
0
down vote
The above answers do not work for me on Mac OS X 10.9.5.
The following code does work:
sed '/.{2048}/d'
.
Although not asked, but provided for reference, the reverse can be achieved the following code:
sed '/.{2048}/!d'
.
The above answers do not work for me on Mac OS X 10.9.5.
The following code does work:
sed '/.{2048}/d'
.
Although not asked, but provided for reference, the reverse can be achieved the following code:
sed '/.{2048}/!d'
.
edited Sep 15 '16 at 21:28
DomainsFeatured
1348
1348
answered Oct 13 '14 at 16:02
wedi
1012
1012
lol, butsed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)
– alex gray
Jul 24 '15 at 13:29
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
add a comment |
lol, butsed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)
– alex gray
Jul 24 '15 at 13:29
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
lol, but
sed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)– alex gray
Jul 24 '15 at 13:29
lol, but
sed: 1: "/.{2048}/d": RE error: invalid repetition count(s)
(Mac OS X, 10.10.4
)– alex gray
Jul 24 '15 at 13:29
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
Ah. I installed the GNU version instead of the BSD version that ships with Mac as @Freedom_Ben suggested above. But Kusalananda found the switch to enable extended regex. So you should go with his solution if you still have that problem. ;)
– wedi
Nov 30 at 19:40
add a comment |
up vote
0
down vote
With gnu-sed, you may use the -r flag, to avoid typing the backslashes, and a comma, to define an open interval:
sed -r "/.{2049,}/d" input.txt > output.txt
with:
- x{2049} meaning exactly 2049 xs
- x{2049,3072} meaning from 2049 to 3072 xs
- x{2049,} meaning at least 2049 xs
- x{,2049} meaning at most 2049 xs
For the intervals, to not match bigger patterns, you would need line anchors like
sed -r "/^.{32,64}$/d" input.txt > output.txt
add a comment |
up vote
0
down vote
With gnu-sed, you may use the -r flag, to avoid typing the backslashes, and a comma, to define an open interval:
sed -r "/.{2049,}/d" input.txt > output.txt
with:
- x{2049} meaning exactly 2049 xs
- x{2049,3072} meaning from 2049 to 3072 xs
- x{2049,} meaning at least 2049 xs
- x{,2049} meaning at most 2049 xs
For the intervals, to not match bigger patterns, you would need line anchors like
sed -r "/^.{32,64}$/d" input.txt > output.txt
add a comment |
up vote
0
down vote
up vote
0
down vote
With gnu-sed, you may use the -r flag, to avoid typing the backslashes, and a comma, to define an open interval:
sed -r "/.{2049,}/d" input.txt > output.txt
with:
- x{2049} meaning exactly 2049 xs
- x{2049,3072} meaning from 2049 to 3072 xs
- x{2049,} meaning at least 2049 xs
- x{,2049} meaning at most 2049 xs
For the intervals, to not match bigger patterns, you would need line anchors like
sed -r "/^.{32,64}$/d" input.txt > output.txt
With gnu-sed, you may use the -r flag, to avoid typing the backslashes, and a comma, to define an open interval:
sed -r "/.{2049,}/d" input.txt > output.txt
with:
- x{2049} meaning exactly 2049 xs
- x{2049,3072} meaning from 2049 to 3072 xs
- x{2049,} meaning at least 2049 xs
- x{,2049} meaning at most 2049 xs
For the intervals, to not match bigger patterns, you would need line anchors like
sed -r "/^.{32,64}$/d" input.txt > output.txt
answered Nov 30 at 0:17
user unknown
7,20812148
7,20812148
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f9981%2fhow-to-delete-line-if-longer-than-xy%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you insist on using sed? This is easy, for example in python. And no doubt even easier in perl. Though the question is not terribly well defined. Copy a file, removing all lines longer than 2048, or something else?
– Faheem Mitha
Mar 23 '11 at 18:21