I should Get the source of GNU tar from Internet (http://ftp.gnu.org/gnu/tar/tar-latest.tar.gz)and extract the list of all C header files included in all files of the source code in a single line of Shell, I know i should use pipelining and concretely the command wget but I don't know how to make it work.If I do it by hand the list goes:wordsplit.hws2tcpip.hxalloc.hxalloc-oversized.hxattr-at.hxattrs.hxgetcwd.hxsize.hSorry if the question is a Little bit dumb and thanks in advance.
Download and extract in a single line of shell
linux;shell;command
Something like this works, but requires curl & tar to be present (usually available by default in most systems)$ curl -sL -o- http://ftp.gnu.org/gnu/tar/tar-latest.tar.gz |tar -tz --wildcards --no-anchored '*.h'tar-1.29/build-aux/snippet/_Noreturn.htar-1.29/build-aux/snippet/arg-nonnull.htar-1.29/build-aux/snippet/c++defs.htar-1.29/build-aux/snippet/unused-parameter.htar-1.29/build-aux/snippet/warn-on-use.htar-1.29/gnu/uniwidth/cjk.htar-1.29/gnu/argp.htar-1.29/gnu/argp-fmtstream.htar-1.29/gnu/argp-namefrob.htar-1.29/gnu/argp-version-etc.htar-1.29/gnu/bitrotate.htar-1.29/gnu/c-ctype.htar-1.29/gnu/c-strcase.htar-1.29/gnu/full-write.htar-1.29/gnu/gettext.htar-1.29/gnu/localcharset.htar-1.29/gnu/mbuiter.htar-1.29/gnu/progname.htar-1.29/gnu/se-context.in.htar-1.29/gnu/se-selinux.in.h---------many more files follow-------------Or even combined with grep: $ curl -sL -o- http://ftp.gnu.org/gnu/tar/tar-latest.tar.gz |tar -zt |grep '/src/.*\.h$'tar-1.29/src/arith.htar-1.29/src/common.htar-1.29/src/tar.htar-1.29/src/xattrs.hConsidering that your question talks about extract the list of all C header files i assume you need just a listing like above.In case you want to get the contents of those .h files, you can use something like this to dump the contents on your screen:$ curl -sL -o- http://ftp.gnu.org/gnu/tar/tar-latest.tar.gz |tar -xzO --wildcards --no-anchored '*.h'Tip: Combine with |less at the end for easy reading.Finally , to make it complete , as advised by @don_crissti to extract the '*.h' files in your local drive instead of screen dumping, you can use:$ curl -sL -o- http://ftp.gnu.org/gnu/tar/tar-latest.tar.gz |tar -xzf - --wildcards --no-anchored '*.h'A new folder tar-1.29 will be created under your current working directory including all .h files.$ ls -ld tar-1.29drwxr-xr-x 7 root root 4096 Mar 24 01:48 tar-1.29$ ls -l tar-1.29total 20drwxr-xr-x 3 root root 4096 Mar 24 01:48 build-auxdrwxr-xr-x 3 root root 4096 Mar 24 01:48 gnudrwxr-xr-x 2 root root 4096 Mar 24 01:48 libdrwxr-xr-x 2 root root 4096 Mar 24 01:48 srcdrwxr-xr-x 2 root root 4096 Mar 24 01:48 tests