There is maybe a additional info needed for library names. Replace blanks to _ if the library name includes blanks.
Example for saving a book-id listing of modified metadata during the last 10 days for the library "Calibre Library" in a text file. In this example the library access is restricted what means you have to set username and password too.
PHP Code:
calibredb list --search "last_modified:>10daysago" --with-library "http://my-server:8080/#Calibre_Library" --username MyUserName --password MyPassword --fields "">Booklist.txt