display output on one line. this is a exerpt from my kshell script

cat <filename> |egrep -v Pattern1|egrep -v Pattern2|egrep -v Pattern3 |egrep -v Pattern3
which displays
Name=john, Age=24, Occupation=Sales
Name=mike, Age=34, Occupation=Unemployed
Name=mike, Age=34, Occupation=Unemployed
Name=mike, Age=34, Occupation=Unemployed

would like to get em all on one line with or without spaces

Recommended Answers

All 2 Replies

Hey There,

Just as an aside, and not to do with the overall solution: If you use egrep, you can make use of it's extended pattern matching functionality to reduce your command line.

For instance:

egrep -v Pattern1|egrep -v Pattern2|egrep -v Pattern3 |egrep -v Pattern4

could be written as

egrep -v 'Pattern1|Pattern2|Pattern3|Pattern4'

which would match any of the for patterns, with the pipe character representing OR within the quotes.

Best wishes,

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.