Here's the problem I'm encountering......My script logs in to remote FTP through password-less "sftp" and must get the list of sub-directories under a given path. I know many of the unix commands don't work in "sftp" login so I cannot know which one is a "directory" and which one is a "file". So I thought of copying the output of ls -l command in a file at local unix server and then going thru it to decide which ones are directories.
Having told my end of the story here's what I'm doing?
What happens?
Value of "list_of_sub-dir" variable has all the info about sub-dir, permissions, size, etc in one single line (as expected):
and so on....
which I want in below format (after stripping "sftp> ls -l /remote/ftp/path")
Then I had a crazy idea of translating (only) spaces (and not new-lines) into commas
here's what I get instead
Can anyone please help me to get this? I really don't know what should I do to somehow preserve "\n" (new-lines) in the variable and not confuse them with "spaces"?!
From what you've posted, it's just a matter of correct quoting:
The background is this: without the quotes, every token separated by one or more whitespaces is given as an argument to echo, which then outputs them separated by exactly 1 space. With the quotes, however, the whole variable is passed as a single argument, including the newlines.
Hello,
I have a file with hundreds of lines. Now I need to replace positions 750-766 in each line (whatever there is there) with spaces... how can I do that?
Which command to use?
The result will be all the lines in the file will have spaces in positions 750-766.
Thanks! (3 Replies)
How to get spaces between the two lines
I have file
File1
A.txt
B.txt
File2
C.txt
D.txt
Doing cat and appending to one file i.e file3
when i was doing append i need output like below
File3
File1 (3 Replies)
Hello All,
I have a file with data as below. Each line consists of 21 fields. I am not able to load them back to the database.
50733339,"834","834 ","005010X279A1","N","Y","007977163","0001 ",30,"2110D ","EB ","EB007 ","2 ","Conditional Required Data Element Miss
ing... (3 Replies)
Is it possible to remove empty lines between >humid-sets (bold) and also humidset that start with -- (for ex: > humid3 | () : | (+) )
Thanx in advance
Note: The humid sets will be in thousands and lines will be more than 100 thousand.
input
> humid1 | () : | (+)... (7 Replies)
Is this possible?
I have a for loop in a shell script reading a list, but I want each line to be a loop, not each thing with a space.
Here is the example:
HOSTLIST="\
1.2.3.4 serverA
1.2.3.5 serverB"
for NBUHOST in `echo $HOSTLIST`
do
ssh ${SERVERNAME} "echo "${NBUHOST}"... (3 Replies)
hi forum
i was wondering can you use tr to print out a file like this
i see that there is no way you could do that i feel
i see that there is no way you could do that i feel
i see that there is no way you could do that i feel
i see that there is no way you could do that i feel
i see that... (2 Replies)
I need some help deleting lines in a file that contain spaces. Im sure awk or sed will work but i dont know much about those commands. Any help is appreciated :D (7 Replies)
All,
I am driving myself crazy over this one. I have run a find command against a volume on a nas. That returns a full listing of path and file name.
This is an example of one line of output. I redirected the output of the find command to a file.
... (4 Replies)
Hello friends,
I want to remove blank spaces at the end of lines. I use sed command to do this but it is not working correctly.
sed ‘s/ $//’ file_name
Can some body tell me what is the proper way to remove blank spaces at the end of a limes.
Thanks,
Mahesh Fernando. (3 Replies)
hi there
i'm trying to delete blank lines and or lines with spaces only from a series of files in an directory.
to do so, i'm using this:
for files in `ls /users/myname/pesop* 2>/dev/null`
do
grep -v ^$ $files > newfile
mv newfile $files
done
now, this works great for blank lines but... (3 Replies)