I'm trying to see what's being stored in a record for the extended character è using ED editor in TCL, when I did the ^ arrow, it showed as ^!!!! invalid character. I even tried to use UNISEQ on the character but it returing null. Does anyone have any ideas? I'm using Universe under Unix AIX.
02 ED TEST TESTEX
1 lines long.
----: t
Top.
0001: è
----: ^
Up-arrow display mode = enabled
WARNING: Line has invalid internal characters, and may display incorrectly.
0001: ^!!!!
You could try AE instead of ED. AE filename record-name. Then use the caret command "^" to show what values are there. Then you can use the R command (replace) to replace it. R/^123/^232/
Try copying the record into a type 19 file (directory) and then open it outside of Universe with a hex editor.
Related
This question already has answers here:
Regex: Remove lines containing "help", etc
(7 answers)
Closed 2 years ago.
I need to obtain something like the following:
may 09 00:11:53 USER audit[1225]: Found device /dasd/cxvxc/...
may 09 00:11:53 USER audit[1226]: more text here
may 09 00:11:53 USER audit[1225]: Found device /mnt/cxvxc/...
may 09 00:11:53 USER audit[1225]: FOUND DEVICE /mnt/cxvxc/...
And remove all the rows where it finds the occurrence of found device (case insensitive).
I tried with \Found\ device, but it is not case insensitive and how do I remove the entire line after finding?
This is maybe not the most advanced version, but should do the trick:
Go to Search -> Replace and activate Regular Expressions. Something like this would match your search
^.*(Found device|FOUND DEVICE).*$
Replace it with an empty string.
This might leaves empty lines, which you can clean with another round of search and replace by deactivating Regular expressions again and using \n for the search-string.
However, I would recommend you to check more specialized tools like sed or awk --- This answer Delete lines in a text file that contain a specific string looks helpful -- and via Geany's "Send selection to"-feature it can be even integrated into Geany quiet easy.
am trying this regex (WVDC)((?:.*\r\n){1}) in notepad++ and it's working, but when I do the same in python it won't
text is
Above 85°C the rated (DC/AC) voltage must be derated at per 1.5%/2.5%°C
WVDC: 400 Volts DC
SVDC: 600 Volts DC
python code
re.search(r'(WVDC)((?:.*\r\n){1})',txt)
The following script is working for me in Python:
input = """Above 85°C the rated (DC/AC) voltage must be derated at per 1.5%/2.5%°C
WVDC: 400 Volts DC
SVDC: 600 Volts DC"""
result = re.findall(r'(WVDC).*\r?\n', input)
print(result)
['WVDC']
Note that the only substantial change I made to the regex pattern was to make the carriage return \r optional. So it seems that multiline strings in Python, perhaps what your source uses, carry only newlines, but not carriage returns. In any case, using \r?\n to match newlines is generally a good idea, because it can cover both Unix and Windows line endings at the same time.
You haven't shown a reproducible example, but opening files in Python in text mode will convert \r\n to \n. Notepad++ maintains the exact line endings.
Removing \r (or making it optional) from the regex should fix the problem in Python. You could also open the file in binary mode, but processing text in text mode is recommended.
This command
%s#^#/*
and this command
%s#$#*/
works fine in vi editor on ubuntu 14.04 when I execute them separately one after another.
What I need is execute them both in one line like
%s#^#/* <bar> %s#$#*/
I also tried | and ; and CR as separator and always get error 488 trailing character
In my vim 7.4 patch 769 this works very well.
:%s/foo/FOO/ | %s/bar/BAR/
It looks like you have omitted the final separator character from your substitutions. Vim doesn't know where your replacement string ends without having the terminating # chars in there. When doing a usual command of one substitution, vim treats the end of the command as the terminating separator if one is not to be found.
For instance, it works if you omit the terminator in the last substitution of the command:
:%s/foo/FOO/ | %s#bar#BAR
And finally a quick tip regarding to your subs. You can wrap a line in text with a single substitution with some basic capture group magic. Match for the whole line and use & in the replacement to reuse the matched text:
:s#.*#/* & */
I need to replace all the strings that look like this:
<\name>
for a TAB
name can be anything from 3 to 15 characters long
I've managed to do it by doing search <.*> replace with \t
Now I need to replace any new lines with a single TAB i.e. remove the new line. For some reason Ultraedit doesn't recognise the new line in the search box. I've used \r and \n, but none of them works.
This is an example of the file, after the search and replace:
1
101
54651
150756
282
506
398
2759
59.62
35737
65
I want to get all that in a single line separated by tabs.
Any ideas?
As you're using Notepad++ I'll assume you're on Windows.
This means the text files you're using were likely created on a DOS type system (including Windows...) and therefore terminate lines with \r\n rather than a single \n like you might find on a UNIX system.
Try searching for that instead.
I have a file with some non-printable characters that come up as ^C or ^B, I want to find and replace those characters, how do I go about doing that?
Removing control symbols only:
:%s/[[:cntrl:]]//g
Removing non-printable characters (note that in versions prior to ~8.1.1 this removes non-ASCII characters also):
:%s/[^[:print:]]//g
The difference between them could be seen if you have some non-printable-non-control characters, e.g. zero-width space:
Say you want to replace ^C with C:
:%s/CtrlVC/C/g
Where CtrlVC means type V then C while holding Ctrl pressed.
CtrlV lets you enter control characters.
Try this after saving your file in vim (assuming you are in Linux environment)
:%!tr -cd '[:print:]\n'
None of the answers here using Vim's control characters worked for me. I had to enter a unicode range.
:%s/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]//g
That unicode range was found on this other post: https://stackoverflow.com/a/8171868/231914
You can use:
:%s/^C//g
To get the ^C hold the control key, press V then C (Both while holding the control key) and the ^C will appear. This will find all occurrences and replace them with nothing.
To remove both ^C and ^B you can do:
:%s/^C\|^B//g
You can use the CTRL-V prefix to enter them, or if they're not easily typeable, yank and insert them using CTRL-R ".
An option not mentioned in other answers.
Delete a specific unicode character with a long hex code, e.g. <200b>:
:%s/\%U200b//g