@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> some good soul here? :)
<1> how i print all parameters, except first?
<1> example: i have 10 fields, i want print 2~10
<2> awk '{for (i=0; i<NF; i++) {print $i;}}' </my/file
<2> awk '{for (i=0; i<10; i++) {print $i;}}' <(cat /etc/fstab | head -n1)
<2> # /etc/fstab: static file system information.
<2> #
<2> /etc/fstab:
<2> static
<2> file
<2> system
<1> WoodyWoodpecker> ok, but my fields dont are new lines, are blocks of text+numbers (srt subtilte file)
<1> WoodyWoodpecker> like this: 217
<1> 02:15:24,620 --> 02:15:29,240
<1> lalala...
<1> 218



<1> 02:15:29,730 --> 02:15:33,450
<1> i see dead ppl!
<1> really!
<2> awk_newbie: What is your IFS?
<2> What character (or list of chars) is it that you want to say, "cut here to next IFS"?
<1> u copy woody?
<1> ops
<1> i send in private and dont see - sry
<1> lets try again :)
<1> i have a file with this formation (SRT subtitle file)
<1> <block_number>\n<time>\n<textline1>\n<textline2\n...<textlineN>\n
<2> awk_newbie: please poste the file.
<2> I am not that good at awk, btw.
<1> i only want work with <block_number> field
<1> but i dont saw some way to filter the entire block
<2> I would use bash:
<2> line="<block_number>\n<time>\n<textline1>\n<textline2\n...<textlineN>\n"; echo "${line%%'\n'*}"
<1> the best i do is change newline to another char (like "_") and process again with awk
<1> but im lost :)
<2> Wait.
<2> Do _do_ have newlines in the file?
<1> yes
<2> Not literally '\n'?
<1> yes
<2> while IFS=$'\n'; read -r line; do echo "${line%%'\n'*}"; done <<<"<block_number>\n<time>\n<textline1>\n<textline2\n...<textlineN>\n";
<1> read \n -> _newline_
<2> IFS=$'\n' read -r
<1> but i have another problem with this - blocks have diferent lengths
<2> The last ";" is not needed btw.
<1> like this:
<2> That doesn't matter _if_ you want to catch the first block_number.
<1> 217
<1> 02:15:24,620 --> 02:15:29,240
<1> lalala...
<1> _new_blank_line_here_
<1> 218
<1> 02:15:29,730 --> 02:15:33,450
<1> i see dead ppl!
<1> really!
<2> ?
<2> So 217 and 02:15.... is in one line and you just didn't print it here?
<1> no
<2> And what do you want to grep exactly?
<2> Ok. Just the way you posted it.
<1> i nid change 217, 218... the block number
<2> Does the number change to 2 or 4 digits?
<1> i nid this:
<1> BEGIN
<1> read file.srt
<1> detect the start of block of subtitle
<1> take the number of subtilte
<1> print $num_subtilte + somenumber;print _rest of block
<2> I don't know enough about awk to write it this language. Do you really need to parse it with awk?
<1> END
<1> or smthing if u known :)
<2> Give me a sec with bash.
<1> ok - u understood my problem? (my english ****s)
<2> So the block number does not change from 3 to 4 or 5 digits.
<1> maybe
<1> the block change to 4 digits



<1> 0001 ~ 9999
<1> ops
<1> 1 ~ 9999
<1> woody
<1> u known if we can put newline in -F awk option?
<1> *new_blank_line or blank_line
<1> like awk -F"blank_line" '{print $1}' show the first block
<1> where "blank_line" must be some control flag of awk
<2> http://rafb.net/paste/results/rwWXP011.html
<2> Yes, awk understands -F'\n'
<1> but not nid -F'\n'
<1> nid -F'line_blank\n'
<2> -F' '
<2> If nothing is on that line, it should just jump to the next one.
<1> ur bash works like "awk '/^[0-9]+$/ {print}' file
<1> i used:awk '/^[0-9]+$/ {print $0*1000}' file
<1> and got :
<1> 217000
<1> 218000
<1> but i nid:
<1> 217000
<1> _sometimehere_
<1> _sometexthere_
<1> _blanklinehere_
<1> 218000
<1> _sometimehere_
<1> _sometexthere_
<1> _blanklinehere_
<1> ...
<2> *sight*
<2> Didn't you tell me that 217 could get a maximum of 4 digits?
<1> its a example
<2> But your awk looks correct too.
<1> in print $0*1000, i demonstrate i just make some calc with block number
<1> some light here!
<1> awk -v ORS="_" '{ print } END { printf "\n" }' dumpsub.srt |awk -F__ '{print $1}'
<1> i got:
<1> 1_01:15:19,000 --> 01:15:21,500_texttextetxt
<1> 2_01:15:21,510 --> 01:15:25,220_texttexttext_texttext
<2> If you don't want to use my bash script, why not use sed?
<1> i dont known sed :)
<2> something like s/^[0-9]\{1,4\}//p
<2> Me neither, but that much I know.
<1> :)
<2> ButI think the last part is wrong.
<1> testing alotoff pipes here :)
<2> sed -n 's/^[0-9]\{1,3\}/p' filename
<1> which condition i put in while (awk) to make until the end of file?
<2> $
<2> ^ <-> start
<2> $ <-> end
<1> whiel (NR != $) do...
<1> ?
<1> *whiel
<1> ***while
<1> :)
<2> http://rafb.net/paste/results/omCI9D42.html
<2> Ahm.
<2> Is for (i=0; i<NR; i++) what you want?
<1> this
<1> thx
<2> I don't know, I never checked.
<2> But I need some sleep now, so good luck what ever you are actually trying to do :-D
<3> windoz is soo use[r]less
<3> and they call bull**** tedh
<3> its wtgay
<3> computers are static crap
<3> call, aka, crap
<3> somebody
<3> brought this tech over to the earth
<3> no stupid fool would ever come to the idea to deal with gay hertx
<3> hertz
<4> Greetings.. in awk (ideally mawk), can I perform a two way pipe? ie. I'd like to be able to both read and write to/from netcat...


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #awk
or
Go to some related logs:

#fedora
#perl
sun java runtime in kbuntu
#fedora
giftoxic ares
ubuntu problem enlightenment install path
#lgp
#web
writing functions to be preprocessed by gcc
c compiler rpm for opensuse 10.0



Home  |  disclaimer  |  contact  |  submit quotes