0

Hello i want to parse file with structure like this... after name: {} it can be other things with same form. something: {}.

--- 
NAMES: 
  first_thing: {}

  second_thing: {}

  name: {}

Thanks for your answers.

I want to parse it to this form

first_thing
second_thing
name
4

2 回答 2

1
perl -ne 'print "$1\n" if /^\s+ (\w+)/x' file

在窗户上:

perl -ne "print qq{$1\n} if /^\s+ (\w+)/x" file
于 2013-05-06T07:06:52.720 回答
0

这可能会有所帮助

preg_match_all('/^(\w+):\s(.*?)$/m', $input, $output, PREG_SET_ORDER);
于 2013-05-06T06:59:32.750 回答