Search Results

Search: Posts Made By: kurumi
Forum: What is on Your Mind? 01-04-2014
1,984
Posted By kurumi
this thread is the most useless thread. ?
this thread is the most useless thread. ?
3,804
Posted By kurumi
if you have Ruby # ruby -F"\s+" -ane...
if you have Ruby

# ruby -F"\s+" -ane '$F[3..-1].each{|x| puts $F[0..2].join(" ") + " " + x }' file
LG1 R500 A-170 F1:81
LG1 R500 A-170 F1:22
LG1 R500 A-170 F2:32
LG1 R500 A-170 F1:71
LG1 R700...
2,906
Posted By kurumi
# echo "abcd fkaj&dsdsd" | ruby -e 's=gets; puts...
# echo "abcd fkaj&dsdsd" | ruby -e 's=gets; puts s.gsub(/([& ;])\1*/,"\\\\\\1")'
abcd\ fkaj\&dsdsd
1,436
Posted By kurumi
bring your password outside the script. Usually...
bring your password outside the script. Usually the way to do this is via a database that provide login mechanisms + encryption. If not, you can set up an encrypted file that stores the password. See...
3,438
Posted By kurumi
$ ruby -ne 'puts $_.gsub(/\s+/,"/")' file $...
$ ruby -ne 'puts $_.gsub(/\s+/,"/")' file
$ ruby -ane 'puts $F.join("/")' file


---------- Post updated at 07:28 AM ---------- Previous update was at 07:27 AM ----------



that don't change...
2,927
Posted By kurumi
$ ruby -ne 'print...
$ ruby -ne 'print $_.gsub(/.*file:\/\/\/|\(score|,\s+docid.*$/,"") if /^\d+\./' file
path1/path2/path3/path4/251192.dat 3.849384
path1/path2/path3/path4/173859.dat 3.831033...
16,217
Posted By kurumi
why not use -c option?
why not use -c option?
31,434
Posted By kurumi
$ tac file | grep -m1 string
$ tac file | grep -m1 string
1,124
Posted By kurumi
ruby -ne 'print if /^[DH]/' file
ruby -ne 'print if /^[DH]/' file
4,447
Posted By kurumi
Ruby(1.9.1+) f=open("file") ...
Ruby(1.9.1+)

f=open("file")
numcols=f.readline.split.size
cols=(1..numcols).to_a.sample(4)
while not f.eof?
line=f.gets.split
cols.each{|x| printf "%s " , line[x-1]}
puts
end...
1,770
Posted By kurumi
$ echo "/home/one/two/three/" | ruby -e 'puts...
$ echo "/home/one/two/three/" | ruby -e 'puts gets.gsub(/\/$/,"").split("/")[-1]'
three

$ echo "/home/one/two/three/" | ruby -e 'puts gets.split("/")[-2]'
three
1,955
Posted By kurumi
$ ruby -ne 'puts...
$ ruby -ne 'puts $_.scan(/[\(\047](.*?)[\)\047]/).flatten.join("\s")' file
130 ESN:27723211621B01DJ68AG AVAILABLE
130 ESN:27723211634ATADJ68AK AVAILABLE
1,586
Posted By kurumi
Ruby(1.9+) $ ruby -i -pne '$_="c\n" if...
Ruby(1.9+)

$ ruby -i -pne '$_="c\n" if $.==2; ARGF.close if ARGF.eof' 3 4
1,586
Posted By kurumi
the variable $. will not reset to 1 once the next...
the variable $. will not reset to 1 once the next file starts. It will continue counting.
9,165
Posted By kurumi
go through the columns, check for "etime", if...
go through the columns, check for "etime", if found, print column 1 and the etime colum. NF means number of fields
17,307
Posted By kurumi
Just for f in *$OLD_EXT; do .... ...
Just

for f in *$OLD_EXT; do
....
echo "Old File: " $f
echo "New File: " $NEW_FILE
.....
done
11,806
Posted By kurumi
$ echo 0000000011179E0A | ruby -e 'print...
$ echo 0000000011179E0A | ruby -e 'print gets.sub(/^0*/,"")'
11179E0A
1,409
Posted By kurumi
1) start with dash /^-/ 2) starts...
1) start with dash

/^-/


2) starts with 1 character then either a "-" or "+" and then up to 3 characters such as "a+rx"


/^.[-+].{1,3}/


---------- Post updated at 11:31 PM ----------...
4,571
Posted By kurumi
Ruby(1.9+) $ ruby -0777 -ne...
Ruby(1.9+)

$ ruby -0777 -ne 's=$_.split("\n"); puts (s.size%2==0)? s[(s.size/2)-1]:s[s.size/2] ' file
6,244
Posted By kurumi
well i missed that out didn't i ? :) to...
well i missed that out didn't i ? :)

to generate base64,


require 'base64'

# xml template
xml=<<EOF
<file>
<text>%s</text>
<pdfcontent>%s</pdfcontent>
</file>
EOF
...
32,274
Posted By kurumi
@cgkmal, there are more information from...
@cgkmal, there are more information from coreutils info.

info coreutils 'ls invocation'
3,294
Posted By kurumi
$ ruby -ne 'BEGIN{srand};puts...
$ ruby -ne 'BEGIN{srand};puts $_.split.shuffle.join(" ")' file
for test is shuffle a random this
$ ruby -ne 'BEGIN{srand};puts $_.split.shuffle.join(" ")' file
for random is shuffle a this test...
Forum: Programming 02-26-2011
3,691
Posted By kurumi
$ ruby -pne '$_.gsub!(/\d+px/,"40px") if...
$ ruby -pne '$_.gsub!(/\d+px/,"40px") if /^\s+height/ && !$_["-"]' file
height: 40px;
line-height: 1.5em;
height: 40px;
height: 40px;
height: 40px;
line-height: 17px;
7,954
Posted By kurumi
Ruby(1.9.1+) $ ruby -e...
Ruby(1.9.1+) $ ruby -e 'a=File.read("file").split; a.permutation(a.length).to_a.each {|x| puts x.join}'
20,351
Posted By kurumi
$ ruby -0777 -ne 'puts...
$ ruby -0777 -ne 'puts $_.gsub(/\/\*.[^\\][^\*]*\*\//m,"")' file

Some text
Text1
Text2
Some text
Note this text
Note here again
Showing results 1 to 25 of 78

 
All times are GMT -4. The time now is 02:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy