SED to remove a Line with REGEX Pattern

bash, regex, sed, unix

Solution

$ sed '/^A.*lorem$/d' file.txt

- `^A`: starts with an `A`

- `.*`: stuff in the middle

- `lorem$`: ends with `lorem`

Problem

i've got a hundreds of files with thousands of lines, which i need to delete some lines that follows a pattern,so i went to SED with regex .The struct of files is something like this ``` A,12121212121212,foo,bar,lorem C,32JL,JL C,32JL,JL C,32JL,JL C,32JL,JL A,21212121212121,foo,bar,lorem C,32JL,JL C,32JL,JL C,32JL,JL A,9999,88888,77777 ``` I need to delete All the lines that starts with "A" and ends with "lorem" Expected output- ``` C,32JL,JL C,32JL,JL C,32JL,JL C,32JL,JL C,32JL,JL C,32JL,JL C,32JL,JL A,9999,88888,77777 ``` I've made the Regex : ``` ^(A).*(lorem) ``` And it match in my text editor (Sublime,UltraEdit) In the UNIX shell ``` sed '/^(A).*(lorem)/d' file.txt ``` But somehow it doesn't work,it shows the whole file, and i can't figure out why. Can someone help me please?

Original source