Removing Indentation from 3GPP Messages – ChatGPT vs. Google Search

If you are in the business of looking at decodes of LTE or 5G signaling messages, you’ve probably been at the point when you wanted to copy and paste a part of that message into an email. The problem: More often than not, the parameters you are interested in are deeply nested in other parameters. 60 to 80 spaces in front of parameter lines are not out of the ordinary these days. Looks pretty ugly when copied and pasted and the result is often totally unreadable. So I was looking for a way to remove a specific number of spaces of all lines of a text file. Should be an easy Google search I thought, but the result was quite disappointing.

So here’s how I searched on Google:

I need a bash command that removes a certain number of spaces at the beginning of each line in a text file

Google finds all kinds of answers but the top answers are about removing ALL spaces at the beginning and not only a certain number. I then modified my search but always came up empty handed.

So I turned to ChatGPT and ran a search with the same sentence. ChatGPT immediately came up with a correct answer and even gave examples. Wow, impressive! Here’s the result for removing 70 spaces in front of each line of file x1 and put the result in file x2:

sed 's/^ \{70\}//' x1.txt >x2.txt

Works like a charm! Google, the air is getting thin!

One thought on “Removing Indentation from 3GPP Messages – ChatGPT vs. Google Search”

  1. Google knows that AI search will change the traditional search space, and they’ve got Bard to rival ChatGPT and its web-connected cousin – Bing chat.

Comments are closed.