With escape sequences "\033[21m" is used to reset/remove bold/bright:
echo -e "Text\033[1mMore text\033[21mEnd"
must return:
TextMore textEnd
but I get
TextMore textE̲n̲d̲
As you can see, in xterm "\033[21m" changes to underline and to reset bold we need to use "\033[0m", why is this?
Is there a way to change this behavior? (maybe launching xterm with some parameter)
According to XTerm Control Sequences, SGR 21 is "doubly-underlined":
CSI Pm m Character Attributes (SGR).
Ps = 2 1 -> Doubly-underlined (ISO 6429).
Ps = 2 2 -> Normal (neither bold nor faint).
Ps = 2 3 -> Not italicized (ISO 6429).
Ps = 2 4 -> Not underlined.
Ps = 2 5 -> Steady (not blinking).
Ps = 2 7 -> Positive (not inverse).
Ps = 2 8 -> Visible, i.e., not hidden (VT300).
Ps = 2 9 -> Not crossed-out (ISO 6429).
Perhaps you intended SGR 22.
The doubly-underlined feature was implemented in xterm patch #305:
minor reorganization to implement “filler” SGR features. There are no established applications which rely upon these; some people find them amusing.
separate bits used to manage drawing state from attribute-bits.
implement SGR codes 2, 3, 9, 21 and their corresponding resets.
add configure option --disable-wide-attrs to disable the feature.
Related
I'm trying to build a diff viewer plugin for my text editor (Kakoune). I'm comparing two files and marking any lines that are different across two panes.
However the two views don't scroll simultaneously. My idea is to get a list of line numbers that correspond to each other, so I can place the cursor correctly when switching panes, or scroll the secondary window when the primary one scrolls, etc.
So - Is there a way to get a list of corresponding numbers from commandline diff?
I'm hoping for something along the following example: Given file A and B, the output should tell me which line numbers (of the ones that didn't change) would correspond.
File A File B Output
1: hello 1: hello 1:1
2: world 2: another 2:3
3: this 3: world 3:4
4: is 4: this 4:5
5: a 5: is
6: test 6: eof
The goal is that when I scroll to line 4 in file A, I'll know to scroll file B such that it's line 5 is rendered at the same position.
Doesn't have to be Gnu diff, but should only use tools that are available on most/all linux boxes.
I can get some of the way using GNU diff, but then need a python script to post-process it to turn a group-based output into line-based.
#!/usr/bin/env python
import sys
import subprocess
file1, file2 = sys.argv[1:]
cmd = ["diff",
"--changed-group-format=",
"--unchanged-group-format=%df %dl %dF %dL,",
file1,
file2]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output = p.communicate()[0]
for item in output.split(",")[:-1]:
start1, end1, start2, end2 = [int(s) for s in item.split()]
n = end1 - start1 + 1
assert(n == end2 - start2 + 1) # unchanged group, should be same length in each file
for i in range(n):
print("{}:{}".format(start1 + i, start2 + i))
gives:
$ ./compare.py fileA fileB
1:1
2:3
3:4
4:5
How to calculate X power Y in the unix shell script where value of Y is being supplied by a loop eg. Y=1 to 5. It means I would like to calculte (X^Y)
In bash you could do:
$ for i in {1..5}; do printf "$((2 ** $i))\n"; doneprintf "$((2 ** $i))\n"; done
2
4
8
16
32
Many shells however do not support raise to power operation and in
such situations you need to use bc:
$ for i in $(seq 5); do printf "%s\n" "$(echo "2 ^ $i" | bc)"; done
2
4
8
16
32
I use OFFIS DICOM dcmdump tool to extract information from a DICOM image:
http://support.dcmtk.org/docs/dcmdump.html
I use dcmdump.exe -M -L +Qn to dump the DICOM information.
Output looks like
Dicom-File-Format
# Dicom-Meta-Information-Header
# Used TransferSyntax: Little Endian Explicit
(0002,0000) UL 164 # 4, 1 FileMetaInformationGroupLength
(0002,0001) OB 00\01 # 2, 1 FileMetaInformationVersion
(0002,0002) UI =DigitalXRayImageStorageForPresentation # 28, 1 MediaStorageSOPClassUID
(0002,0003) UI [1.2.826.0.1.3680043.2.876.8598.1.4.0.20160428091911.2.2] # 56, 1 MediaStorageSOPInstanceUID
(0002,0010) UI =JPEGLSLossless # 22, 1 TransferSyntaxUID
(0002,0012) UI [1.2.276.0.64] # 12, 1 ImplementationClassUID
Why did dcmdump translate (0002,0010) to the value JPEGLSLossless instead of 1.2.840.10008.1.2.4.80 ?
Is there any switch to do so?
dcmdump does so because it translates well known UIDs to human readable meanings by default.
The parameter you are searching for to change this behavior is -Un (--no-uid-names)
When using autoIt to get Window's Text and the WinGetText matches multiple controls (e.g. with the same Class SciCalc in this case), the WinGetText will concatenate the text of all the controls. How can I get the Text of the n-th (say 3rd 'MR') control?
e.g.
Local $output = WinGetText("[CLASS:SciCalc]", "")
print
output:666666.
MC
MR
MS
M+
7
4
1
0
8
5
2
+/-
9
6
3
.
/
*
-
+
=
Backspace
CE
C
1/x
sqt
%
Something like this
ControlGetText("[CLASS:SciCalc]","","[CLASS:Button; INSTANCE:3]")
Use AutoIt Window Info to find the Advanced mode details on the wanted control.
I am running neo-4j 1.8.2 on a remote unix box. I am using this jar (https://github.com/jexp/batch-import/downloads).
nodes.csv is same as given in example:
name age works_on
Michael 37 neo4j
Selina 14
Rana 6
Selma 4
rels.csv is like this:
start end type since counter:int
1 2 FATHER_OF 1998-07-10 1
1 3 FATHER_OF 2007-09-15 2
1 4 FATHER_OF 2008-05-03 3
3 4 SISTER_OF 2008-05-03 5
2 3 SISTER_OF 2007-09-15 7
But i am getting this exception :
Using Existing Configuration File
Total import time: 0 seconds
Exception in thread "main" java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
at org.neo4j.batchimport.Importer$Data.split(Importer.java:156)
at org.neo4j.batchimport.Importer$Data.update(Importer.java:167)
at org.neo4j.batchimport.Importer.importNodes(Importer.java:226)
at org.neo4j.batchimport.Importer.main(Importer.java:83)
I am new to neo4j, was checking if this importer can save some coding effort.
It would be great if someone can point to the probable mistake.
Thanks for help!
--Edit:--
My nodes.csv
name dob city state s_id balance desc mgr_primary mgr_secondary mgr_tertiary mgr_name mgr_status
John Von 8/11/1928 Denver CO 1114-010 7.5 RA 0023-0990 0100-0110 Doozman Keith Active
my rels.csv
start end type since status f_type f_num
2 1 address_of
1 3 has_account 5 Active
4 3 f_of Primary 0111-0230
Hi I had some issues in the past with the batch import script.
The formating of your file must be very rigorous, which means :
no extra spaces where not expected, like the ones I see in the first line of your rels.csv before "start"
no multiple spaces in place of the tab. If your files are exactly like what you've copied here, you have 4 spaces instead of on tab, and this is not going to work, as the script uses a tokenizer looking for tabs !!!
I had this issue because I always convert tabs to 4 spaces, and once I understood that, I stopped doing it for my csv !