Search Results

Search: Posts Made By: kurumi
Forum: What is on Your Mind? 01-04-2014
1,745
Posted By kurumi
this thread is the most useless thread. ?
this thread is the most useless thread. ?
3,356
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,222
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,124
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...
2,919
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,715
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...
823
Posted By kurumi
ruby -ne 'print if /^[DH]/' file
ruby -ne 'print if /^[DH]/' file
3,411
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,438
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,607
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,155
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,155
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.
25,733
Posted By kurumi
$ tac file | grep -m1 string
$ tac file | grep -m1 string
7,535
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
10,305
Posted By kurumi
$ echo 0000000011179E0A | ruby -e 'print...
$ echo 0000000011179E0A | ruby -e 'print gets.sub(/^0*/,"")'
11179E0A
16,011
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
1,251
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 ----------...
3,464
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
5,359
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
...
14,754
Posted By kurumi
why not use -c option?
why not use -c option?
31,782
Posted By kurumi
@cgkmal, there are more information from...
@cgkmal, there are more information from coreutils info.

info coreutils 'ls invocation'
2,330
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,421
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;
17,671
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
1,369
Posted By kurumi
$ ruby -F"\|" -ane 'puts...
$ ruby -F"\|" -ane 'puts $F.select{|x|!x[/^lobfile/]}.join("|")' file
1200|name1|abcd
1201|name2|abcd
Showing results 1 to 25 of 78

 

Featured Tech Videos

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