Reply to comment
Using "\n" as delimiter of cut
Submitted by zhigang on Mon, 2008-03-17 17:35You cannot specify "\n" directly with Bash:
$ brctl show | cut -d "\n" -f 2 | cut -f 1 cut: the delimiter must be a single character Try `cut --help' for more information.
The correct syntax is:
$ brctl show | cut -d " > " -f 2 | cut -f 1 testbr
But "\n" can be used directly in system call of other programming language rather than Bash. Eg.
# python
Python 2.4.3 (#1, Jun 6 2007, 15:09:38)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> status = os.system('brctl show | cut -d "\n" -f 2 | cut -f 1')
testbr
>>> import commands
>>> print commands.getoutput('brctl show | cut -d "\n" -f 2 | cut -f 1')
testbr
»
- Add new comment
- 55 reads


Recent comments
15 weeks 4 days ago
40 weeks 4 days ago
47 weeks 1 day ago
49 weeks 5 days ago
1 year 1 week ago
1 year 49 weeks ago