Skip to content

Instantly share code, notes, and snippets.

@surajRathi
Last active August 9, 2023 09:16
Show Gist options
  • Save surajRathi/b49474efd96d8bab70eb3b5ac81cb90f to your computer and use it in GitHub Desktop.
Save surajRathi/b49474efd96d8bab70eb3b5ac81cb90f to your computer and use it in GitHub Desktop.
Extract dependencies from ROS package launch files
#!/usr/bin/zsh
cat **/**.launch | grep -oE '\$\(find [^)]*\)' | cut -d ' ' -f 2 | cut -d ')' -f 1 | sort | uniq
cat **/**.launch | grep -oE 'pkg="[^" ]*?"' | cut -d '"' -f 2 | sort | uniq
# (cat **/**.launch | grep -oE '\$\(find [^)]*\)' | cut -d ' ' -f 2 | cut -d ')' -f 1 | sort | uniq; cat **/**.launch | grep -oE 'pkg="[^" ]*?"' | cut -d '"' -f 2 | sort | uniq) | sort | uniq
@srathi-monarch
Copy link

srathi-monarch commented Aug 9, 2023

To roughly extract packages from includes

comm -23 <((cat **/**.h; cat **/**.cpp) | sed -nr 's:^[ ]*#include[ ]*<([^\/>]+)[^>]*>:\1:p' | sort | uniq) <(ls /usr/include/c++/9 -1 | sort | uniq)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment