Suppose we have a text file contain like this :
tedy@tedy-laptop:~$ cat temp.txt 6287756200410 6281803360820 6281938729213 6287841613739 6281703456007 6287756236052 6281907128431 tedy@tedy-laptop:~$
If we want to remove three digits from each line, we can use the following command :
tedy@tedy-laptop:~/Desktop$ cat temp.txt | sed -e 's/...$//g' 6287756200 6281803360 6281938729 6287841613 6281703456 6287756236 6281907128 tedy@tedy-laptop:~$
If we want to remove six digits from each line, we can use the following command :
tedy@tedy-laptop:~/Desktop$ cat temp.txt | sed -e 's/......$//g' 6287756 6281803 6281938 6287841 6281703 6287756 6281907 tedy@tedy-laptop:~$