I would like to use some command in linux that can delete number from file.
01 - Lukas Graham - 7 Years [OFFICIAL MUSIC VIDEO]
02 - Prince Royce - La Carretera (Official Video)
result
Lukas Graham - 7 Years
Prince Royce - La Carretera
Following awk
may also help you on same:
awk '{sub(/[^a-zA-Z]*/,"");sub(/ [[(].*/,"");print}' Input_file
Output will be as follows:
Lukas Graham - 7 Years
Prince Royce - La Carretera
Explanation: Adding explanation too here:
awk '{
sub(/[^a-zA-Z]*/,""); ##Subsituting by using sub keyword of awk everything from starting to till first occurence of any alphabet comes with NULL in current line.
sub(/ [[(].*/,""); ##Subsituting from space either [ or ( to till last as per OP request with NULL in current line.
print ##Printing the current line now.
}
' file ##Mentioning the Input_file name here.
With
sed
:The output: