I have been trekking and camping since last 6 yrs. I have over 600 hikes and about 30 technical rock climbs under my belt. We often tend to camp up in forests, and at our sides, wild boars are pretty normal. Though I have never been under an attack by a wild boar, I just want to know that instead of running away (never in a straight line though), do I stand a chance to pretend to be aggressive if they out-number me? Few of the civilians suggested that it works most of the times if they out-number you. They loose their formation and run away. I just want to know if such a thing happened and/or (deliberately) done by anyone? How safe is it?
I have come across wild boars about a dozen times (I admit, not that much), in numbers from a single male, mothers with young upto groups of 30-40 and I've never felt threatened. Sometimes the leading (fe)male might approach you aggressively just long enough for the rest of the group to run away and then retreat too. I usually stay silent and try to observe them, which has upto now not been seen as a thread or provoked any aggression. While this is probably no different than your own experience, I have too always anticipated the "what if" scenario. What I keep in mind is:
It may be worth taking into account that in some places animals can become more agressive as they lose their fear of humans. Here in Europe hunters may feed animals to create artificial overpopulations, which in some places has resulted in the boars affiliating humans with food. Where this is the case, they are much harder to intimidate and scare off.
As others point out, avoiding them is key, and because they're so aggressive it's generally the better stance to take. That said, if you find yourself unavoidably coming up against one then being aggressive can work (though of course this isn't guaranteed.) Often if you attack one and the rest see that you're capable of that, then they'll run away (as seen in this video, ish, though they do come charging back at various points!)
However, it's a big risk, and they won't always run after something like this - they may even go the other way and get more aggressive! So if you think that you have the manpower and weapons to successfully take them on and stand your ground, then you may wish to, but I'd only do this as a last resort - if for instance a member of the party was injured and there was no way to move them. How safe is it? Not very.
As pointed out in the comments, this (already rather substantial) risk increases by orders of magnitude if there's a sow with babies.
It all depends on where you are hiking (you may want to edit that into your question) as to the type of wild boar one may encounter.
I have backpacked extensively around the Southwestern U.S. and I've come across as many as 7-10 javelina and they are of little threat to hikers. I had edited that I had never heard of a single attack but then found a snip-it that a Tucson woman walking her three Chihuahuas was attacked in 2006 (although I don't know how credible the source was). In my back-country experience they are afraid of people. I imagine if you had one or more cornered and you were provoking them to the point that they felt threatened they'd give a nasty bite. Attacks to humans are extremely rare. People do refer to them as wild boars but I think of the dark haired large tusked variety and not javelina.
The hyperlink above shows the javelina and facts at the AZ Game and Fish website.
FYI, I would've put this as a comment but don't have that ability yet.