I have a lot of names with Date characters front of them:
- Code: Select all
Char1 2020-10-28
Char2 2020-10-28
Char3 2020-10-28
Char4 2020-10-16
Char5 2020-10-28
Char6 2020-10-26
I want to have a Bash script that remove all these dates.
Thank you.
Char1 2020-10-28
Char2 2020-10-28
Char3 2020-10-28
Char4 2020-10-16
Char5 2020-10-28
Char6 2020-10-26
cut -d " " -f 1 data.txt
Bloom wrote:If data.txt contains your data, just do:
- Code: Select all
cut -d " " -f 1 data.txt
If you want to save the output, add '>newfile.txt' after data.txt.
Bloom wrote:If in front of the dates, a tab is present, replace the -d " " by -d\t or remove the option (tab is the default separator for cut).
cut -f 1 "File Name"
Users browsing this forum: No registered users and 8 guests