Example:
3|100|test@test.com|0|0|6:1,10,11,12,13,2,3,4,5,6,9|7:1,10,11,13,16,2,4,5,6,9|
Expected view after grep:
test@test.com
|
|
Use
|
|||||
|
|
Why grep? Use
|
|||
|
|
|
Maybe awk is better suited for this usage:
If you have to extract more than one field from such an input, I think it is the easiest using awk. (OFF: excuse me if I pointed in an awk-ward direction) |
|||||||||||||||||
|
|
Just Imagine your content is present under this file
To cut the
Here
suppose
Then we have to use To cut [max@localhost ~]$ cut -d ":" -f1 file1 root To cut [max@localhost ~]$ cut -d ":" -f2 file1 x To cut [max@localhost ~]$ cut -d ":" -f3 file1 0 |
|||
|
|
|
Just for fun, here's how you could do it with
The first regex grabs the first three pipe delimited fields. The second grep picks out the last field and tr removes the remaining delimiter. |
|||
|
|