Sed - An Introduction and Tutorial by Bruce Barnett
|
Do not fret!?It is not your fault you don't understand?sed. I will cover?sed?completely. But I will describe the features in the order that I learned them. I didn't learn everything at once. You don't need to either. Sed?has several commands,but most people only learn the substitute command:?s. The substitute command changes all occurrences of the regular expression into a new value. A simple example is changing "day" in the "old" file to "night" in the "new" file: sed s/day/night/ Or another way (for UNIX beginners), sed s/day/night/ old >new and for those who want to test this: echo day | sed s/day/night/ This will output "night". I didn't put quotes around the argument because this example didn't need them. If you read my earlier tutorial?,you would understand why it doesn't need quotes. However,I recommend you do use quotes. If you have meta-characters in the command,quotes are necessary. And if you aren't sure,it's a good habit,and I will henceforth quote future examples to emphasize the "best practice." Using the strong (single quote) character,that would be: sed 's/day/night/' I must emphasize that the sed editor changes exactly what you tell it to. So if you executed echo Sunday | sed 's/day/night/' This would output the word "Sunnight" because sed found the string "day" in the input. Another important concept is that sed is line oriented. Suppose you have the input file: one two three,one two three four three two one one hundred and you used the command sed 's/one/ONE/' |
- nubia z9 plus什么时候上市 nubia z9 plus上市时间
- linux – 如何在bash中将IDN转换为Punycode?
- linux – GRUB stage 1.5的代码驻留在磁盘上的位置是什么?
- 怎样使用lshw检阅Linux设备信息
- 深度刷机让毫秒级一键ROOT成为现实,彻底告别odin刷hboot繁
- linux – 检测我的共享库的两个ABI不兼容版本加载到单个程序
- ruby-on-rails – git post-receive hook没有运行bundle in
- linux – PostgreSQL高性能安装程序
- 如何在Linux上捕获键盘事件并将监视器用作文本显示?
- 三星照片存在哪里 三星如何更改照片存储位置

