ultraedit技巧收集

1 ultraledit的dos文件格式

2 常用快捷键和操作

3  ultraedit查找和替换的正则表达式语法

ultraedit的dos文件格式

用UltraEdit打开文件时有时会提示“提示希望转换xxx 到DOS格式吗?”原因如下:
     很久以前,人们用老式的电传打字机作为输入设备,它使用两个字符来另起新行。一个字符把滑动架移回首位 (称为回车,DE><CR>DE>),另一个字符把纸上移一行(称为换行,DE><LF>DE>)。


     当计算机问世后,由于存储器曾经非常昂贵。有些人就认定没必要用两个字符来表示行尾。 于是UNIX 开发者决定他们可以用 DE><Line Feed>DE> 一个字符来表示行尾。Apple开发者规定了用 DE><CR>DE>。开发 MS-DOS (以及微软视窗) 的那些家伙则决定沿用老式的 DE><CR>DE>DE><LF>DE>。

 

三种行尾格式如下:


unix            DE><LF>DE>
dos             DE><CR>DE>DE><LF>DE>
mac             DE><CR>DE>


这意味着,如果你试图把一个文件从一种系统移到另一种系统,那么你就有换行符方面的麻烦。


ultraedit取消该提示的措施:


如果你的程序将来需要在UNIX/linux,最好是保持 unix的格式。

点选 高级 菜单—>文件处理 —> 选择 DOS/UNIX/MAC 处理 ,在右侧的unix/mac 文件检测/转换下面,勾上 禁用。确定,以后就不会提示了。

英文:Advanced->Configuration->File Handing->DOS/UNIX/MAC Handling->UNIX/MAC file detection/conversion.selected the "Disable"!

 

常用快捷键和操作

1:ctrl+b 括号匹配

    写代码的时候,括号一般要一一对应的,但是如果嵌套太多,看花眼了,怎么办?你把光标放在括号开始的地方,按ctrl+b,UE 会帮你找到相对应的括号结尾的地方。你还可以试试连着多按几次ctrl+b。

 

2:如何删除所编辑文本中包含特定字符串的行 
    这则技巧是在UltraEdit的帮助文件里提到.CTRL+R 调出来替换(Replace)窗口,选中"使用正则表达式";然后用查找 %*你的字符串*^p 替换成空内容即可.如,我当前有个文本文件,需要去掉所有包含 DBA Blog 这个字符串的行,查找 %*DBA Blog*^p  替换成空即可.注意 ,^p 是 DOS 文件类型的换行符.如果是 Unix 类型文件,则用 ^n.

 

3:F3查找下一个/ctrl+f3查找上一个

   默认情况下,当你按F3的时候UltraEdit可以查找现在选中的内容,F3是下一个符合的内容,ctrl+f3是上一个符合的内容.

 

4:如何在行末添加特定字符,比如逗号

     CTRL+R 调出来替换(Replace)窗口,选中"使用正则表达式".然后可以查找 ^p(或者^n,如果是Unix 文件),用 ,^p(或者,^n)进行"全部替换".

 

5:删除空行

     查找 ^p$ 然后替换为空即可。

     注意:^p$只能匹配一个不含空格的行。

 

6:ctrl+f2

     代码会有很多行你当然可以记得你要到的行数,然后用ctrl+g,然后输入行号,到所在的行。但是用ctrl+f2我觉得更方便。比如说你要频繁在多个 function中切换。可以在function开始的地方,按一下ctrl+f2,给这一行加一个书签。然后再另外的function开始的地方,也来 一下ctrl+f2,有书签的地方,字的背景色会不同。当你想换到下一个书签的时候,就按f2,但是想到上一个标签怎么办?ctrl+f2?不对,再按就 是加书签或者取消当前行的书签了。应该是alt +f2.

 

7:ctrl+tab
    多个文件中切换,用鼠标点,麻烦.

 

8:删除整行

   定位光标要删除的行,然后用ctrl+e即可.

 

9:列编辑
 
   Alt+c


10:插入系统时间

     按F7,就看看效果怎么样.


11:拷贝(Copy)和粘贴(Paste)的内容不匹配

     UltraEdit有10个剪切板(clipboard),分别用Ctrl+0 - Ctrl+9 切换. Ctrl+0 是 Windows 的,其他则为用户自定义的.如果在使用的过程中错调用了 CTRL+n, 这就会使拷贝(Copy)和粘贴(Paste)的内容不匹配.

 

Regular Expressions (UltraEdit Syntax):

在使用查找 替换 功能时,ultraedit可以使用正则表达式。

ultraedit 支持的正则表达式语法:

Symbol

Function

%

Matches the start of line - Indicates the search string must be at the beginning of a line but does not include any line terminator characters in the resulting string selected.

$

Matches the end of line - Indicates the search string must be at the end of line but does not include any line terminator characters in the resulting string selected.

?

Matches any single character except newline.

*

Matches any number of occurrences of any character except newline.

+

Matches one or more of the preceding character/expression.  At least one occurrence of the character must be found.  Does not match repeated newlines.

++

Matches the preceding character/expression zero or more times.  Does not match repeated newlines.

^b

Matches a page break.

^p

Matches a newline (CR/LF) (paragraph) (DOS Files)

^r

Matches a newline (CR Only) (paragraph) (MAC Files)

^n

Matches a newline (LF Only) (paragraph) (UNIX Files)

^t

Matches a tab character

[xyz]

A character set.  Matches any characters between brackets.

[~xyz]

A negative character set.  Matches any characters NOT between brackets including newline characters.

^{A^}^{B^}

Matches expression A OR B

^

Overrides the following regular expression character

^(…^)  

Brackets or tags an expression to use in the replace command.  A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.
 

The corresponding replacement expression is ^x, for x in the range 1-9.  Example: If ^(h*o^) ^(f*s^) matches "hello folks", ^2 ^1 would replace it with "folks hello".

 

也可以使用unix的正则表达式:

 

Symbol

Function

\

Indicates the next character has a special meaning.  "n" on it’s own matches the character "n".  "\n" matches a linefeed or newline character.  See examples below (\d, \f, \n etc).

^

Matches/anchors the beginning of line.

$

Matches/anchors the end of line.

*

Matches the preceding character zero or more times.

+

Matches the preceding character one or more times.  Does not match repeated newlines.

Matches any single character except a newline character.  Does not match repeated newlines.

(expression)

Brackets or tags an expression to use in the replace command.  A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.
 

The corresponding replacement expression is \x, for x in the range 1-9.  Example: If (h.*o) (f.*s) matches "hello folks", \2 \1 would replace it with "folks hello".

[xyz]

A character set.  Matches any characters between brackets.

[^xyz]

A negative character set.  Matches any characters NOT between brackets including newline characters.

\d

Matches a digit character.  Equivalent to [0-9].

\D

Matches a nondigit character.  Equivalent to [^0-9].

\f

Matches a form-feed character.

\n

Matches a linefeed character.

\r

Matches a carriage return character.

\s

Matches any whitespace including space, tab, form-feed, etc but not newline.

\S

Matches any non-whitespace character but not newline.

\t

Matches a tab character.

\v

Matches a vertical tab character.

\w

Matches any word character including underscore.

\W

Matches any nonword character.

\p

Matches CR/LF (same as \r\n) to match a DOS line terminator.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值