I have the following file on my Ubuntu machine:
http://example.com/https:/www.google.com http://test.example.com https://www.example.com https://www.click.example.com http://example.com http://test.example.com https://www.example.com/https:/www.google.com https://www.click.example.com
I want the output in the new file:
https://www.example.com https://www.click.example.com https://www.example.com/https:/www.google.com https://www.click.example.com
I am using sed as shown below, but it includes in the output file all lines that contain https anywhere in the line.
sed -n '/https/p' file.txt > new_file.txt
I want to limit the search to the first 5 characters: if it finds the
https in the first 5, then print the line and otherwise skip it.