0

Hi i got many files which look like this:

relation:
xxxxxx
birthday:
xxxxxx
age:
xxxxxx
livingsituation:
xxxxxx
place:
xxxxxx
school:
xxxxxxx
job:
xxxxxxx
but i also got other files which look like this:

relation:
xxxxxx
age:
xxxxxx
livingsituation:
xxxxxx
place:
xxxxxx
job:
xxxxxxx in which xxxxxx is variable

My problem is that all files should get the same order, as you can see in the example above, school is left out in the second file.

Now i need something which checks whether there is a certain line in the file, like school or birthday, and if not, that school or birthday is inserted. And plus that there should also be an empty line inserted under the word just inserted.

So actually the second file should look, after processing in shell script, exactly like the first one.

Any ideas? thanks

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by thekashyap
0

I would use a combination of grep and sed to do this... use grep for the pattern matching, and use sed to do the inline text editing. Do you have to do this with just shell script? Personally, I find it a lot easier to tackle this type of problem with perl or python.

-Josh
www.qbangsolutions.com

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.