linux/bash equivalent of mv -t

anotherperson1
ls -al | grep -v '^d' | xargs mv -t mysubdir

I use the above command extensively on Red Hat systems.

It moves all files in the current directory to mysubdir

$ mv --version
Usage: mv [-f] [-i] [-e warn|force|ignore] f1 f2
       mv [-f] [-i] [-e warn|force|ignore] f1 ... fn d1
       mv [-f] [-i] [-e warn|force|ignore] d1 d2

what is the above command's equivalent in HP-UX (HP-UX 11i Version 3 Feb 2007)

roaima

If xargs on your HP-UX 11i has the -I flag you can do this, although I'm not entirely sure how you have managed to use ls -l output with the mv:

ls -al | grep -v '^d' | xargs -I {} mv {} mysubdir

Failing that you could do this, which I think would be my preferred solution:

ls -a | while read ITEM; do test ! -d "$ITEM" && mv "$ITEM" mysubdir; done

Either can be encompassed with a shell function or script, so the length of the one-liner isn't necessarily relevant.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

macOS/bash equivalent of mv -t

From Dev

Is there an equivalent of cd - for cp or mv?

From Dev

'mv' equivalent of drag and drop with replace?

From Dev

Can't find folder after mv command

From Dev

mv command - don't overwrite files

From Dev

if the file is a directory don't move it mv bash

From Dev

equivalent of vector<T> in Java

From Dev

POSIX equivalent to column -t

From Dev

How can I run `git mv --index` (the --index option isn't available on git mv)

From Dev

How can I run `git mv --index` (the --index option isn't available on git mv)

From Dev

can't find node_modules after mv command

From Dev

What is the added value of the -T option in GNU cp and mv?

From Dev

Why isn't this sudo mv operation with wildcard working?

From Dev

Why doesn't the free space on the source partition change during "mv"?

From Dev

What does '-t' do in mv command? Example below

From Dev

Ubuntu 16.04: Erroneously executed `mv` with `~/*` as target and can't understand the outcome

From Dev

Can't use $myvar_.* to mv files starting with $myvar_

From Dev

Equivalent of ClassMapping<T>.Property() in FluentNHibernate

From Java

LINQ equivalent of foreach for IEnumerable<T>

From Dev

Isn't double[][] equivalent to **double?

From Dev

F# ICastableTo<'T> equivalent?

From Dev

F# ICastableTo<'T> equivalent?

From Dev

Equivalent of hdparm -t for home directory?

From Dev

LinuxBash does not open in the current folder

From Dev

sort -t $'\t' equivalent compatible with POSIX sh?

From Dev

What is the equivalent of dispatch_block_t in swift?

From Dev

What is the Rust equivalent of `size_t`?

From Dev

Equivalent t-test results in PANDAS?

From Dev

__darwin_size_t equivalent to in c#

Related Related

HotTag

Archive