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

Pages: 1-

any ideas?

Name: Anonymous 2012-06-06 21:53

I am high as shit right now and had this idea for something which I don't know how to do

I am not a programmer or CS student or anything

but can someone please write be a shellscript which will echo the first word (delimited by a space) of a randomly selected line in a text file, then echo (on the same line) a word from a different text file in a sequence (so 1 the first time, then 2 the second, etc) then the second word (delimited by a space) on the same line as in the first step in the first text file

and do this for as many words are in the second text file

example:

~$cat file1.txt
a b
c d
e f
g h
i j
k l
m n
~$cat file2.txt
1 2 3 4 5 6 7 8 9 10
~$./script.sh > hurr.txt
~$cat hurr.txt
i1j m2n a3b g4h e5f e6f k7l a8b i9j g10h

thank you very much

Name: Anonymous 2012-06-06 22:03

~$cat file1.txt
a
b
c
d
e
f
g
h
i
j
k
l
m
n
~$cat
file2.txt
1
2 3 4 5 6 7 8 9 10
~$./script.sh
> hurr.txt
~$cat
hurr.txt
i1j
m2n a3b g4h e5f e6f k7l a8b i9j g10h

Name: Anonymous 2012-06-06 22:49

#!/bin/sh
echo $(for i in `cat file2.txt`
  do
    tail -n \
      +$(expr $(head -c4 /dev/urandom | od -D | grep -o ' [0-9]\+') % \
              $(wc -l < file1.txt)) \
      file1.txt | head -n 1 | sed "s/ /$i/"
  done)

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