Operating System - HP-UX
1748219 Members
4716 Online
108759 Solutions
New Discussion юеВ

Re: Cannot scp files to another server

 
Fenglin
Regular Advisor

Cannot scp files to another server

Hi

I want to scp some files to another server

ssh: Could not resolve hostname audfile2_2006Sep30_12: no address associated with name

I am able to ping to the other server but I encounter the error above while scp the files.The hosts file looks ok.

Source directory : HP-UX server
Target directory : Linux server

Please advice.

Regards
Feng Lin
9 REPLIES 9
Steven Schweda
Honored Contributor

Re: Cannot scp files to another server

> The hosts file looks ok.

Great, but I can't see it, and I don't trust
you. I also can't see your "scp" command.

> ssh: Could not resolve hostname
> audfile2_2006Sep30_12: no address
> associated with name

"scp" seems to think that that's a host name.
If you thought that that was a file name,
then I'd guess that your "scp" command is
defective. Perhaps if my psychic powers
were stronger, then I might not need to
guess. Or, if you showed what you actually
did, ...

"scp -h"? "man scp"?

> Source directory : HP-UX server
> Target directory : Linux server

Not very complete descriptions of these
systems, or their software, either.
Kapil Jha
Honored Contributor

Re: Cannot scp files to another server

which is ur target host

nslookup is fine?? try with IP....

#scp file username@IP:/path_to_put
this should ask for passwd....
if any error try doing normal ssh is thats working.

BR
Kapil+
I am in this small bowl, I wane see the real world......
Yogesh M Puranik
Valued Contributor

Re: Cannot scp files to another server

Hi Fenglin,

Your check points:

1]Make sure that you should ve host entry both server in /etc/hosts.

2]Please check ssh is working properly.

3]check traceroute between source and destination ,as well as telnet with 22 port is working properly.


Rgds
++
YMP
Fenglin
Regular Advisor

Re: Cannot scp files to another server

Hi

It's because the files that I want to transfer contain semi-colons. The filenames are for e.g filename_date_12_00:00.txt

That's why it complained about the hostnames.

Any idea how to replace the semi-colon by an underscore for selected files in that directory?

Thanks a lot.

Feng Lin
Steven Schweda
Honored Contributor

Re: Cannot scp files to another server

> It's because the files that I want to
> transfer contain semi-colons.

Why didn't I guess that?

> The filenames are for e.g
> filename_date_12_00:00.txt

I don't see a semi-colon anywhere in that
name.

Normally, one can quote (using apostrophes or
quotation marks) or escape (using
backslashes) any shell-special characters in
a file name. I might be able to show you
how to do this in your command, but I'm still
not psychic, and you still haven't shown your
command.

> [...] I also can't see your "scp" command.

Did you not read this? Did you think I was
joking? Are you trying to waste everyone's
time? Is there something secret about your
"scp" command, and you're afraid of the CIA?

> Any idea how to replace the semi-colon by
> an underscore for selected files in that
> directory?

bash$ echo 'a;b;c' | sed -e 's/;/_/g'
a_b_c

But I don't really know what you're trying to
do, so I don't know how you might use this
method.
SANTOSH S. MHASKAR
Trusted Contributor

Re: Cannot scp files to another server

Hi,

Still u have not given the command u r using.

Also if u have embedded special chars. in file name just put the file name in single quotes.

eg. ''
eg. 'adfd###????!!!!;;;;::::>>>'


Pl. give the syntax u are using. So that we can help u.


-Santosh
Fenglin
Regular Advisor

Re: Cannot scp files to another server

Hi All

ok, Let's say I have a lot of files with naming convention, filename_2006Mar27_12:00.gz in a specific directory. I want to change all the files in that directory from filename_2006Mar27_12:00.gz to filename_2006Mar27_12_00.gz (That is an example)

Regarding the scp issue, its been resolved because once I replace the : with _ , I will be able to scp to the linux server. I tested and it worked.

Thanks
Feng Lin
Steven Schweda
Honored Contributor

Re: Cannot scp files to another server

> ok, Let's say I have a lot of files with
> naming convention,
> filename_2006Mar27_12:00.gz in a specific
> directory. I want to change all the files
> in that directory from
> filename_2006Mar27_12:00.gz to
> filename_2006Mar27_12_00.gz (That is an
> example)

You may think that that's clear, but it's
not. For example:

Do you want to rename all the files in that
directory with ":" in the name?

Do you want to rename all the files in that
directory with "_2006Mar27_" and ":" in the
name?


I'd probably write a short shell script which
uses "sed" to transform a file name (as shown
above), and then uses "mv" to rename the
file. Then I might use "find -exec" to run
that shell script against the file names
which "find" finds. This assumes that I knew
which file names to ask "find" to find, which
I don't.
Mel Burslan
Honored Contributor

Re: Cannot scp files to another server



for file in `ls -1 filename_*`
do
newname=`echo ${file} | sed -e "1,1s/:/_/"`
mv ${file} ${newname}
done

this will rename all files suiting the naming convention you gave. If they have more than one colon ":" in the name, only the first one will be replaced by and underscore"_". If you have more than one colon and replace all of them, then modify the sed directive between double quotes as follows:
"1,1s/:/_/g"
note the "g" at the end

Hope this helps

Also, please take some time to rate the answers you have received in the past. Here are the questions you asked and received answers without assigning any points:

https://forums11.itrc.hp.com/service/forums/publicProfile.do?userId=WW74647&forumId=1

Your point assignment ratio, sits at an abysmal 22% level
________________________________
UNIX because I majored in cryptology...