-1

I have a large file with over 800k entries (access log file). I need to output a file with only clean URLs (without parameters / "?") in the URL.

Output should only display entries that DON'T have a "?" in the URL.

Parameter url:

http://www.example.com/sample?parameter=1

2 Answers2

5

In POSIX grep with the --invert-match (short: -v) for inverse match,

grep --invert-match "?" file

Or using awk with !

awk '!/?/' file

Using GNU sed with --quiet or --silent (short: -n):

sed --quiet '/?/!p' file
breversa
  • 107
  • 6
Inian
  • 80,270
  • 14
  • 142
  • 161
3

@Seasonal_showers: You haven't shown us a handful samples, so considering that your Input_file will have only URLs and nothing else, could you please try following then.

grep -v '?' Input_file

Let me know if this is not helping, you could show more sample Input_file details for better understanding then.

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93