How to NOT include certain no. of patterns in the output? - bash

I have a command -
some command | egrep -i "($query_value)"
which returns lines like -
> 2018-01-12 23:17:05.097 Info: Deleted 6 MB at 1129 MB/sec
> /Meters/00002c97 2018-01-12 23:17:05.104 Info: Deleted 6 MB at 864
> MB/sec /Meters/00002c99 2018-01-12 23:26:00.751 Info: Saving
> /Meters/00002c9a 2018-01-12 23:26:01.235 Info: Saved 6 MB at 12 MB/sec
> to /Meters/00002c9a 2018-01-12 23:26:01.268 Info: Merging 12 MB from
> /Meters/00002c9b and /Meters/00002c9a to /Meters/00002c9d,
> timestamp=15158205609400820 2018-01-12 23:26:04.248 Info: Deleted 9 MB
> at 3898 MB/sec /Meters/00002c9b 2018-01-12 23:26:04.250 Info: Deleted
> 6 MB at 2973 MB/sec /Meters/00002c9a 2018-01-12 23:34:01.420 Info:
> Saving /Meters/00002c9c 2018-01-12 23:34:02.192 Info: Saved 6 MB in 1
> sec at 8 MB/sec to /Meters/00002c9c 2018-01-12 23:34:02.248 Info:
> Merging 44 MB from /Meters/00002c98, /Meters/00002c9d, and
> /Meters/00002c9c to /Meters/00002c9f, timestamp=15158210419400730
> 2018-01-12 23:34:07.173 Info: Deleted 35 MB at 9431 MB/sec
> /Meters/00002c98 2018-01-12 23:34:07.175 Info: Deleted 12 MB at 6633
> MB/sec /Meters/00002c9d 2018-01-12 23:34:07.177 Info: Deleted 6 MB at
> 2869 MB/sec /Meters/00002c9c 2018-01-12 23:42:00.842 Info: Saving
> /Meters/00002c9e 2018-01-12 23:42:01.323 Info: Saved 6 MB at 12 MB/sec
> to /Meters/00002c9e 2018-01-12 23:51:00.951 Info: Saving
> /Meters/00002ca0 2018-01-12 23:51:01.680 Info: Saved 6 MB in 1 sec at
> 8 MB/sec to /Meters/00002ca0 2018-01-12 23:51:01.684 Info: Merging 10
> MB from /Meters/00002c9e and /Meters/00002ca0 to /Meters/00002ca2,
> timestamp=15158220605927080 2018-01-12 23:51:05.083 Info: Deleted 6 MB
> at 2127 MB/sec /Meters/00002c9e 2018-01-12 23:51:05.085 Info: Deleted
> 6 MB at 2933 MB/sec /Meters/00002ca0 2018-01-12 23:58:01.110 Info:
> Saving /Meters/00002ca1 2018-01-12 23:58:02.011 Info: Saved 6 MB in 1
> sec at 7 MB/sec to /Meters/00002ca1 2018-01-12 23:58:02.017 Info:
> Merging 12 MB from /Meters/00002ca2 and /Meters/00002ca1 to
> /Meters/00002ca4, timestamp=15158224804450160 2018-01-12 23:58:05.096
> Info: Deleted 9 MB at 419 MB/sec /Meters/00002ca2 2018-01-12
> 23:58:05.105 Info: Deleted 6 MB at 668 MB/sec /Meters/00002ca1
but further I want to exclude lines that contains patterns like merging*mb*from|merged*mb*from. I don't want lines like -
Merging 12 MB from or Merged 12 MB from .
I tried using grep's -v option but seems like it doesn't understand case sensitivity and 'AND', 'OR' operations.

Following sed may help you in same.
sed -n '/Merging.*MB.*from/d;/Merged.*MB.*from/d;p' Input_file
OR
sed -n '/[mM]erging.*[mM][bB].*from/d;/Merged.*MB.*from/d;p' Input_file
EDIT: Adding explanation too here for above code.
sed -n ' ##-n will STOP printing by default for any line of Input_file till we print it explicitly.
/Merging.*MB.*from/d; ##Looking for string Merging.*MB.*from and using d will skip it and will NOT print it.
/Merged.*MB.*from/d; ##Looking for string Merged.*MB.*from and using d will skip it and will not print it.
p ##mentioning p will print the lines apart from lines which have above mentioned string in them
' Input_file ##Mentioning Input_file name here.

Try grep -E (extended regex) -i (ignore case) -v (invert match):
grep -E -i -v 'merg(ing|ed).*mb.*from'
If you think "ignore case" is slow, then:
grep -E -v '[Mm]erg(ing|ed).*[Mm][Bb].*[Ff]rom'

Related

Get the size of files and folders in mb through command prompt?

In my system some of my files are in gb .
Through command prompt using dir command we can get the size of the files but the size which it shows
its in kb.
I have to manually convert this to mb.
command : dir
How to get the size of the files in mb?
In cmd you need to use a for loop and convert the file info to the format you want.
For %_ in ("C:\FolderPath\*") DO #(Set /A %~z_ / 1048576 &Echo. Mb %~nxt_ )
NOTE: It is essential that you include a File Mask (In my example case *, but it could also be Somefile*.* or *.* or some other variant)
Example Results:
C:\Admin>For %_ in ("C:\*") DO #(Set /A %~z_ / 1048576 &Echo. Mb %~nxt_ )
0 Mb 11/07/2007 08:00 AM eula.1028.txt
0 Mb 11/07/2007 08:00 AM eula.1031.txt
0 Mb 11/07/2007 08:00 AM eula.1033.txt
0 Mb 11/07/2007 08:00 AM eula.1036.txt
0 Mb 11/07/2007 08:00 AM eula.1040.txt
0 Mb 11/07/2007 08:00 AM eula.1041.txt
0 Mb 11/07/2007 08:00 AM eula.1042.txt
0 Mb 11/07/2007 08:00 AM eula.2052.txt
0 Mb 11/07/2007 08:00 AM eula.3082.txt
0 Mb 02/09/2019 10:26 AM External_URL_Monitor_2019-02-09_09.26.14.2614.log
3 Mb 02/09/2019 10:47 AM External_URL_Monitor_2019-02-09_09.27.53.2753.log
3 Mb 02/09/2019 11:20 AM External_URL_Monitor_2019-02-09_09.59.28.5928.log
4 Mb 02/09/2019 11:57 AM External_URL_Monitor_2019-02-09_10.23.56.2356.log
23 Mb 02/09/2019 03:20 PM External_URL_Monitor_2019-02-09_11.49.20.4920.log
4 Mb 02/09/2019 10:47 AM Internal_URL_Monitor_2019-02-09_09.27.55.2755.log
3 Mb 02/09/2019 11:21 AM Internal_URL_Monitor_2019-02-09_09.59.34.5934.log
4 Mb 02/09/2019 11:57 AM Internal_URL_Monitor_2019-02-09_10.23.59.2359.log
0 Mb 02/09/2019 03:21 PM Internal_URL_Monitor_2019-02-09_11.41.15.4115.log
1 Mb 02/09/2019 10:05 AM URL_Monitor_2019-02-09_09.01.40.140.log
1 Mb 11/07/2007 08:50 AM VC_RED.cab
0 Mb 11/07/2007 08:53 AM VC_RED.MSI
1 Mb 06/06/2012 05:23 PM Windows6.1-KB2639043-v5-x64.msu
File sizes in MiB:
powershell -NoLogo -NoProfile -Command ^
"Get-ChildItem -File | ForEach-Object {'{0:N2} {1}' -f #(($_.Length / 1mb), $_.FullName)}"

How to capture header of file, then perform further text processing on original file?

I would like to capture the first 8 lines of the following file, then capture all fields where NPU # is equal to 7 or 3, and NPU core is equal to 1.
RP/0/RP0/CPU0:xxxxx#show controllers npu voq-usage interface all instance all location 0/0/CPU0
33144 Tue Jun 4 xxxx
33145 -------------------------------------------------------------------
33146 Node ID: 0/0/CPU0
33147 Intf Intf NPU NPU PP Sys VOQ Flow VOQ Port
33148 name handle # core Port Port base base port speed
33149 (hex) type
33150 ----------------------------------------------------------------------
33151 Hu0/0/2/1 210 0 1 21 21 1024 4152 local 100G
33152 Hu0/0/2/47 218 7 0 1 701 1032 4152 local 100G
33153 Hu0/0/2/46 220 7 0 5 705 1040 4216 local 100G
33154 Hu0/0/2/45 228 7 0 9 709 1048 4280 local 100G
33155 Hu0/0/2/44 230 3 1 17 717 1056 4152 local 100G
I'm able to do this with the following disparate awk commands:
awk 'NR<9' filename.txt
awk '($4==7||$4==3) && $5==1' filename.txt
Can I get some advice on how I might join these awk statement together? Or maybe even a bash-ism that would be more elegant to achieve this?
Thanks,
I suggest using a || operator and group the second condition:
awk 'NR<9 || (($4==7||$4==3) && $5==1)' filename.txt > newfilename.txt
See the online demo:
s="RP/0/RP0/CPU0:xxxxx#show controllers npu voq-usage interface all instance all location 0/0/CPU0
33144 Tue Jun 4 xxxx
33145 -------------------------------------------------------------------
33146 Node ID: 0/0/CPU0
33147 Intf Intf NPU NPU PP Sys VOQ Flow VOQ Port
33148 name handle # core Port Port base base port speed
33149 (hex) type
33150 ----------------------------------------------------------------------
33151 Hu0/0/2/1 210 0 1 21 21 1024 4152 local 100G
33152 Hu0/0/2/47 218 7 0 1 701 1032 4152 local 100G
33153 Hu0/0/2/46 220 7 0 5 705 1040 4216 local 100G
33154 Hu0/0/2/45 228 7 0 9 709 1048 4280 local 100G
33155 Hu0/0/2/44 230 3 1 17 717 1056 4152 local 100G"
awk 'NR<9 || (($4==7||$4==3) && $5==1)' <<< "$s"
Output:
RP/0/RP0/CPU0:xxxxx#show controllers npu voq-usage interface all instance all location 0/0/CPU0
33144 Tue Jun 4 xxxx
33145 -------------------------------------------------------------------
33146 Node ID: 0/0/CPU0
33147 Intf Intf NPU NPU PP Sys VOQ Flow VOQ Port
33148 name handle # core Port Port base base port speed
33149 (hex) type
33150 ----------------------------------------------------------------------
33155 Hu0/0/2/44 230 3 1 17 717 1056 4152 local 100G
awk '(NR<9) || (($4~/^[73]$/) && ($5==1))' filename.txt
Could you please try 1 more way.
awk 'NR<=9{print;next} ($4==7||$4==3) && $5==1' Input_file
This might work for you (GNU sed):
sed -E '1,8b;/^(\S+\s+){3}[37]\s+1\s/!d' file
Print lines 1 to 8 and any lines where the 4th field is either 3 or 7 and 5th field is 1.

docker stats showing "--"

When running docker stats I see:
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
11e22031f0be -- -- / -- -- -- / -- -- / -- --
f55b3bbf6115 0.00% 26.98 MiB / 7.795 GiB 0.34% 0 B / 0 B 6.728 MB / 0 B 2
ff7800652fa1 0.30% 21.61 MiB / 7.795 GiB 0.27% 0 B / 0 B 16.69 MB / 270.2 MB 9
d422fe2d0f1a 0.12% 14.23 MiB / 7.795 GiB 0.18% 0 B / 0 B 7.055 MB / 0 B 5
86df65e7c195 0.04% 6.141 MiB / 7.795 GiB 0.08% 0 B / 0 B 6.192 MB / 0 B 2
1d0c20d5ea48 0.27% 32.51 MiB / 7.795 GiB 0.41% 0 B / 0 B 23.48 MB / 0 B 11
--
Does anyone know what the -- indicates? The container is running and I can view the non-zero per-process statistics using top. What does the -- mean?
The result of docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
11e22031f0be aaaaaaaaaaa "run master" 28 hours ago Up 28 hours agitated_bhaskara
f55b3bbf6115 bbbbbbbbb "run ovn-controller" 28 hours ago Up 28 hours ovn-controller
ff7800652fa1 quay.io/coreos/etcd:v3.0.2 "/usr/local/bin/etcd " 28 hours ago Up 28 hours etcd
d422fe2d0f1a ccccc/ovs "run ovs-vswitchd" 28 hours ago Up 28 hours ovs-vswitchd
86df65e7c195 ddddd/ovs "run ovsdb-server" 28 hours ago Up 28 hours ovsdb-server
1d0c20d5ea48 eeeeeeeeeeeeeeee "abcde minino" 28 hours ago Up 28 hours minion

Phoneme Recognition with PocketSphinx

I need the real-time phoneme recognition from the microphone on Windows 8 Desktop. So I followed http://cmusphinx.sourceforge.net/wiki/phonemerecognition and built pocketsphinx_continuous from the subversion source in VS2013. Running it in the command line as Administrator:
D:\_SPHINX\cmusphinx-code-13103-trunk\pocketsphinx\bin\Release\Win32>pocketsphinx_continuous.exe -infile ../../../test/data/goforward.raw -hmm ../../../model/en-us/en-us -allphone ../../../model/en-us/en-us-phone.lm.bin -backtrace yes -beam 1e-20 -pbeam 1e-20 -lw 2.0
INFO: pocketsphinx.c(145): Parsed model-specific feature parameters from ../../../model/en-us/en-us/feat.params
Current configuration:
[NAME] [DEFLT] [VALUE]
-agc none none
-agcthresh 2.0 2.000000e+000
-allphone ../../../model/en-us/en-us-phone.lm.bin
-allphone_ci no no
-alpha 0.97 9.700000e-001
-ascale 20.0 2.000000e+001
-aw 1 1
-backtrace no yes
-beam 1e-48 1.000000e-020
-bestpath yes yes
-bestpathlw 9.5 9.500000e+000
-ceplen 13 13
-cmn current current
-cmninit 8.0 40,3,-1
-compallsen no no
-debug 0
-dict
-dictcase no no
-dither no no
-doublebw no no
-ds 1 1
-fdict ../../../model/en-us/en-us/noisedict
-feat 1s_c_d_dd 1s_c_d_dd
-featparams ../../../model/en-us/en-us/feat.params
-fillprob 1e-8 1.000000e-008
-frate 100 100
-fsg
-fsgusealtpron yes yes
-fsgusefiller yes yes
-fwdflat yes yes
-fwdflatbeam 1e-64 1.000000e-064
-fwdflatefwid 4 4
-fwdflatlw 8.5 8.500000e+000
-fwdflatsfwin 25 25
-fwdflatwbeam 7e-29 7.000000e-029
-fwdtree yes yes
-hmm ../../../model/en-us/en-us
-input_endian little little
-jsgf
-keyphrase
-kws
-kws_delay 10 10
-kws_plp 1e-1 1.000000e-001
-kws_threshold 1 1.000000e+000
-latsize 5000 5000
-lda
-ldadim 0 0
-lifter 0 22
-lm
-lmctl
-lmname
-logbase 1.0001 1.000100e+000
-logfn
-logspec no no
-lowerf 133.33334 1.300000e+002
-lpbeam 1e-40 1.000000e-040
-lponlybeam 7e-29 7.000000e-029
-lw 6.5 2.000000e+000
-maxhmmpf 30000 30000
-maxwpf -1 -1
-mdef ../../../model/en-us/en-us/mdef
-mean ../../../model/en-us/en-us/means
-mfclogdir
-min_endfr 0 0
-mixw
-mixwfloor 0.0000001 1.000000e-007
-mllr
-mmap yes yes
-ncep 13 13
-nfft 512 512
-nfilt 40 25
-nwpen 1.0 1.000000e+000
-pbeam 1e-48 1.000000e-020
-pip 1.0 1.000000e+000
-pl_beam 1e-10 1.000000e-010
-pl_pbeam 1e-10 1.000000e-010
-pl_pip 1.0 1.000000e+000
-pl_weight 3.0 3.000000e+000
-pl_window 5 5
-rawlogdir
-remove_dc no no
-remove_noise yes yes
-remove_silence yes yes
-round_filters yes yes
-samprate 16000 1.600000e+004
-seed -1 -1
-sendump ../../../model/en-us/en-us/sendump
-senlogdir
-senmgau
-silprob 0.005 5.000000e-003
-smoothspec no no
-svspec 0-12/13-25/26-38
-tmat ../../../model/en-us/en-us/transition_matrices
-tmatfloor 0.0001 1.000000e-004
-topn 4 4
-topn_beam 0 0
-toprule
-transform legacy dct
-unit_area yes yes
-upperf 6855.4976 6.800000e+003
-uw 1.0 1.000000e+000
-vad_postspeech 50 50
-vad_prespeech 20 20
-vad_startspeech 10 10
-vad_threshold 2.0 2.000000e+000
-var ../../../model/en-us/en-us/variances
-varfloor 0.0001 1.000000e-004
-varnorm no no
-verbose no no
-warp_params
-warp_type inverse_linear inverse_linear
-wbeam 7e-29 7.000000e-029
-wip 0.65 6.500000e-001
-wlen 0.025625 2.562500e-002
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
INFO: acmod.c(164): Using subvector specification 0-12/13-25/26-38
INFO: mdef.c(518): Reading model definition: ../../../model/en-us/en-us/mdef
INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef file
INFO: bin_mdef.c(336): Reading binary model definition: ../../../model/en-us/en-us/mdef
INFO: bin_mdef.c(516): 42 CI-phone, 137053 CD-phone, 3 emitstate/phone, 126 CI-sen, 5126 Sen, 29324 Sen-Seq
INFO: tmat.c(206): Reading HMM transition probability matrices: ../../../model/en-us/en-us/transition_matrices
at the last INFO line Windows 8 throws this error:
Is anything wrong with PocketSphinx debug output, or my command-line options? Or it is a pure Windows problem? I noticed this folder: /bin/Release/Win32. My Windows 8 is 64bit on Intel NUC. Sphinxbase.dll was compiled from subversion in Debug mode, while PacketSphinx had only Release mode.
Also I read somewhere that phonemes timing information is available - how to get it?
ADDITION: following Nikolay's advice, with these parameters, I eliminated errors, but got no phonemes:
D:\_SPHINX\pocketsphinx\bin\Debug>pocketsphinx_continuous.exe -infile ../../test/data/goforward.raw -hmm ../../model/en-us/en-us -allphone ../../model/en-us/en-us.lm.dmp -backtrace yes -beam 1e-20 -pbeam 1e-20 -lw 2.0 -debug 3 -verbose yes
INFO: cmd_ln.c(697): Parsing command line:
pocketsphinx_continuous.exe \
-infile ../../test/data/goforward.raw \
-hmm ../../model/en-us/en-us \
-allphone ../../model/en-us/en-us.lm.dmp \
-backtrace yes \
-beam 1e-20 \
-pbeam 1e-20 \
-lw 2.0 \
-debug 3 \
-verbose yes
. . . .
INFO: acmod.c(252): Parsed model-specific feature parameters from ../../model/en-us/en-us/feat.params
INFO: fe_interface.c(177): Current FE Parameters:
INFO: fe_interface.c(178): Sampling Rate: 16000.000000
INFO: fe_interface.c(179): Frame Size: 410
INFO: fe_interface.c(180): Frame Shift: 160
INFO: fe_interface.c(181): FFT Size: 512
INFO: fe_interface.c(183): Lower Frequency: 130
INFO: fe_interface.c(185): Upper Frequency: 6800
INFO: fe_interface.c(186): Number of filters: 25
INFO: fe_interface.c(187): Number of Overflow Samps: 0
INFO: fe_interface.c(188): Start Utt Status: 0
INFO: fe_interface.c(190): Will not remove DC offset at frame level
INFO: fe_interface.c(196): Will not add dither to audio
INFO: fe_interface.c(200): Will apply sine-curve liftering, period 22
INFO: fe_interface.c(203): Will normalize filters to unit area
INFO: fe_interface.c(205): Will round filter frequencies to DFT points
INFO: fe_interface.c(207): Will not use double bandwidth in mel filter
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
INFO: acmod.c(171): Using subvector specification 0-12/13-25/26-38
INFO: mdef.c(518): Reading model definition: ../../model/en-us/en-us/mdef
INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef file
INFO: bin_mdef.c(336): Reading binary model definition: ../../model/en-us/en-us/mdef
INFO: bin_mdef.c(516): 42 CI-phone, 137053 CD-phone, 3 emitstate/phone, 126 CI-sen, 5126 Sen, 29324 Sen-Seq
INFO: tmat.c(206): Reading HMM transition probability matrices: ../../model/en-us/en-us/transition_matrices
INFO: acmod.c(124): Attempting to use PTM computation module
INFO: ms_gauden.c(198): Reading mixture gaussian parameter: ../../model/en-us/en-us/means
INFO: ms_gauden.c(292): 42 codebook, 3 feature, size:
INFO: ms_gauden.c(294): 128x13
INFO: ms_gauden.c(294): 128x13
INFO: ms_gauden.c(294): 128x13
INFO: ms_gauden.c(198): Reading mixture gaussian parameter: ../../model/en-us/en-us/variances
INFO: ms_gauden.c(292): 42 codebook, 3 feature, size:
INFO: ms_gauden.c(294): 128x13
INFO: ms_gauden.c(294): 128x13
INFO: ms_gauden.c(294): 128x13
INFO: ms_gauden.c(354): 222 variance values floored
INFO: ptm_mgau.c(476): Loading senones from dump file ../../model/en-us/en-us/sendump
INFO: ptm_mgau.c(500): BEGIN FILE FORMAT DESCRIPTION
INFO: ptm_mgau.c(563): Rows: 128, Columns: 5126
INFO: ptm_mgau.c(595): Using memory-mapped I/O for senones
INFO: ptm_mgau.c(835): Maximum top-N: 4
INFO: phone_loop_search.c(115): State beam -225 Phone exit beam -225 Insertion penalty 0
INFO: dict.c(320): Allocating 4101 * 20 bytes (80 KiB) for word entries
INFO: dict.c(342): Reading filler dictionary: ../../model/en-us/en-us/noisedict
INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones
INFO: dict.c(345): 5 words read
INFO: dict2pid.c(396): Building PID tables for dictionary
INFO: dict2pid.c(406): Allocating 42^3 * 2 bytes (144 KiB) for word-initial triphones
INFO: dict2pid.c(132): Allocated 21336 bytes (20 KiB) for word-final triphones
INFO: dict2pid.c(196): Allocated 21336 bytes (20 KiB) for single-phone word triphones
INFO: ngram_model_arpa.c(77): No \data\ mark in LM file
INFO: ngram_model_dmp.c(142): Will use memory-mapped I/O for LM file
INFO: ngram_model_dmp.c(196): ngrams 1=19794, 2=1377200, 3=3178194
INFO: ngram_model_dmp.c(242): 19794 = LM.unigrams(+trailer) read
INFO: ngram_model_dmp.c(288): 1377200 = LM.bigrams(+trailer) read
INFO: ngram_model_dmp.c(314): 3178194 = LM.trigrams read
INFO: ngram_model_dmp.c(339): 57155 = LM.prob2 entries read
INFO: ngram_model_dmp.c(359): 10935 = LM.bo_wt2 entries read
INFO: ngram_model_dmp.c(379): 34843 = LM.prob3 entries read
INFO: ngram_model_dmp.c(407): 2690 = LM.tseg_base entries read
INFO: ngram_model_dmp.c(463): 19794 = ascii word strings read
INFO: allphone_search.c(239): Building PHMM net of 137095 phones
INFO: allphone_search.c(312): 29324 nodes, 1958591 links
INFO: allphone_search.c(611): Allphone(beam: -450, pbeam: -450)
INFO: continuous.c(299): pocketsphinx_continuous.exe COMPILED ON: Aug 23 2015, AT: 14:00:33
INFO: cmn_prior.c(131): cmn_prior_update: from < 40.00 3.00 -1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 >
INFO: cmn_prior.c(149): cmn_prior_update: to < 44.50 -4.13 0.15 6.94 4.06 -5.38 -2.56 -3.13 -6.12 -1.20 -7.44 -2.25 0.48 >
INFO: allphone_search.c(852): 214 frames, 214 HMMs (1/fr), 642 senones (3/fr), 214 history entries (1/fr)
INFO: allphone_search.c(865): allphone 0.61 CPU 0.283 xRT
INFO: allphone_search.c(867): allphone 0.62 wall 0.290 xRT
INFO: allphone_search.c(911): Hyp: SIL
INFO: pocketsphinx.c(1133): SIL (-858993460)
word start end pprob ascr lscr lback
SIL 51 264 1.000 -1627 0 0
INFO: allphone_search.c(911): Hyp: SIL
SIL
INFO: cmn_prior.c(131): cmn_prior_update: from < 44.50 -4.13 0.15 6.94 4.06 -5.38 -2.56 -3.13 -6.12 -1.20 -7.44 -2.25 0.48 >
INFO: cmn_prior.c(149): cmn_prior_update: to < 44.50 -4.13 0.15 6.94 4.06 -5.38 -2.56 -3.13 -6.12 -1.20 -7.44 -2.25 0.48 >
INFO: allphone_search.c(852): 0 frames, 0 HMMs (0/fr), 0 senones (0/fr), 0 history entries (0/fr)
INFO: allphone_search.c(651): TOTAL fwdflat 0.61 CPU 0.285 xRT
INFO: allphone_search.c(654): TOTAL fwdflat 0.64 wall 0.298 xRT
What is the correct set of command-line parameters, to get phonemes output?

How can I sort columns of text in Vim by size?

Given this text
affiliates 1038 680 KB
article_ratings 699 168 KB
authors 30 40 KB
fs.chunks 3401 633.89 MB
fs.files 1476 680 KB
nodes 1432 24.29 MB
nodes_search 91 2.8 MB
nodes_tags 272 40 KB
page_views 107769 16.37 MB
page_views_map 212 40 KB
recommendations 34305 45.1 MB
rewrite_rules 209 168 KB
sign_ups 10331 12.52 MB
sitemaps 1 14.84 MB
suppliers 13 8 KB
tariff_price_check_reports 34 540 KB
tariff_price_checks 1129 968 KB
tariffs 5 680 KB
users 17 64 KB
users_tags 2 8 KB
versions 18031 156.64 MB
How can I sort by the 4th and then 3rd column so that it's sorted by file size?
I've tried :%!sort -k4 -k3n which partially works, but seems to fail on the 3rd size column.
What am I doing wrong?
I think I've figured it out.
:%!sort -k4 -bk3g
I sort by the the 4th column (-k4), followed by the 3rd column. We ignore leading blank spaces (b), and this time we sort using a general numeric sort (g).
I blogged about this too
I don't know how to handle it with sort(). I've found problems with the decimal point, although I changed the LC_NUMERIC environment variable, so I would switch to perl to solve it, like:
:%!perl -0777 -ne '
#l = map { [ $_, split " ", $_ ] } split /\n/, $_;
#l = sort { $a->[-1] cmp $b->[-1] or $a->[-2] <=> $b->[-2] } #l;
print "$_->[0]\n" for #l
'
Put it in the same line to run if from inside vim. It yields:
suppliers 13 8 KB
users_tags 2 8 KB
authors 30 40 KB
nodes_tags 272 40 KB
page_views_map 212 40 KB
users 17 64 KB
article_ratings 699 168 KB
rewrite_rules 209 168 KB
tariff_price_check_reports 34 540 KB
affiliates 1038 680 KB
fs.files 1476 680 KB
tariffs 5 680 KB
tariff_price_checks 1129 968 KB
nodes_search 91 2.8 MB
sign_ups 10331 12.52 MB
sitemaps 1 14.84 MB
page_views 107769 16.37 MB
nodes 1432 24.29 MB
recommendations 34305 45.1 MB
versions 18031 156.64 MB
fs.chunks 3401 633.89 MB

Resources