I'm new to Linux. I've a file which contains list of movie names and their release year. I want to list out all release years. Specifically my file looks like below  TDKR(2012)    Vicky Cristina Barcelona (2008)  ...I tried grep with regex as followsgrep ^.*\\([0-9]*\\)$ movie.txtand it works but it is printing entire line I want only years. Can I do it with grep?
Extract integers enclosed in round brackets
text processing;grep
GNU grep supports an -o option which will give you the matching pattern, so you could use grep -o '([0-9]\+)' but this will also print the parentheses. For more flexibility and portability, though, you should post-process with sed:grep '([0-9]\+)$' movie.txt | sed 's/.*(\([0-9]\+\))$/\1/'# assumes that the year is always at the end of the line.