formatting output from a remote server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting formatting output from a remote server
# 1  
Old 06-12-2008
formatting output from a remote server

Hi Unix Gurus,
I have the following output from a remote sftp server


sftp> cd outgoing
sftp> ls
.
..
archive
x001_ameint_BP020F0025_00306_001.zip
x001_ameint_DV010F0060_00306_001.zip
x001_ameint_DV010F0065_00306_001.zip
x001_ameint_DV010F0065_00306_002.zip
x001_ameint_DV010F0070_00306_001.zip
x001_ameint_DV020F0040_00306_001.zip
sftp>

I'd like only the lines starting with x001 in a new file how to do that
my output should be

x001_ameint_BP020F0025_00306_001.zip
x001_ameint_DV010F0060_00306_001.zip
x001_ameint_DV010F0065_00306_001.zip
x001_ameint_DV010F0065_00306_002.zip
x001_ameint_DV010F0070_00306_001.zip
x001_ameint_DV020F0040_00306_001.zip


The output is varying a lot sometimes the output of the ls command is space delimited, sometimes tab delimited , how to format the output in a genric way.


any help appreciated.
thanks
ram
# 2  
Old 06-15-2008
ls|grep *001.zip > files.out
# 3  
Old 06-15-2008
i've moved the thread from solaris to scripting. this is not a solaris only problem....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep remote multiple hosts output to local server

Hello all, i'm trying to create a report by greping a pattern on multiple remote hosts and creta a simple report, actually i did this, is ther any better way to do this. #!/bin/bash for host in `cat RemoteHosts` do ssh $host -C 'hostname 2>&1; grep ERROR /var/log/WebServer.log.2019-09-21... (0 Replies)
Discussion started by: charli1
0 Replies

2. UNIX for Dummies Questions & Answers

Executing ksh script to remote server want output on same window

I'm having a brain freeze moment. I've created a ksh script in AIX that ssh's to a remote server, executes some commands, and then logs out. All of this is sent to a file. I then have the script cat the file so i can see the output. Even though the cat command is outside of the remote session part;... (5 Replies)
Discussion started by: seekryts15
5 Replies

3. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

4. Shell Programming and Scripting

How to get the for loop output from a remote server in UNIX shell scripting?

Hi, I am using ksh , when i try to use for loop i am getting the expected output. $for variable in $(ps -fu user | grep -i something/ | grep -i something | grep -v grep | awk '{print $2}');do > grep $variable /tmp/some_path/*/* > done when tried the below to remote server, getting... (4 Replies)
Discussion started by: karthikram
4 Replies

5. Shell Programming and Scripting

output from remote server during execution of a script

How to see the output from remote server during execution of a script ? I am executing a script (ls) from machine 1 but the o/p should be displayed in machine 2. Can I achieve this ? Example:- Machine 1:- # ls Machine 2:- (console) file1 file2 file 3 dir1 dir2 (0 Replies)
Discussion started by: frintocf
0 Replies

6. Shell Programming and Scripting

Remote server's output

Hi All, Can anybody help me, i have 50 servers within a network. For checking the HDD utilization using df -k, Right now i am logging into each server daily and then noting the output. I want that i should be able to run the command in all servers while sitting in single server and getting... (1 Reply)
Discussion started by: varunksharma87
1 Replies

7. Shell Programming and Scripting

rsh help - getting the output of remote script to local server.

Hi, I have a script that runs for an hour. Have to run it on remote server and need the output it produces on the remote server to decide for failure or success. I run it through a Autosys Job which logs the outputs, both 1 & 2. I use the commands 1) rsh <SERVER> 'nohup /tmp/xyz.ksh &' 2)... (5 Replies)
Discussion started by: aster007
5 Replies

8. Shell Programming and Scripting

Remote server file output redirection

Hi, I want ssh to the remote server and then execute ls and redirect the output to the file in remote server itself like ssh root@$server `ls /var/log/users.txt > root@$server:/home/users.txt` Can you please let me know the correct syntax for it. Thanks in advance (2 Replies)
Discussion started by: mohitmoudgil
2 Replies

9. UNIX for Dummies Questions & Answers

Mailing the output which is there in remote server

Hi all, I have a script which logs in to the remote server with FTP and with the user id/password and list the files in the path of remote server where thefiles resid.i need to email this output(i.e wether the files are present on not under the path) to my email id. Can u please let me know as... (2 Replies)
Discussion started by: OSD
2 Replies

10. Shell Programming and Scripting

Mailing the output which is there in remote server

Hi all, I have a script which logs in to the remote server with FTP and with the user id/password and list the files in the path of remote server where thefiles resid.i need to email this output(i.e wether the files are present on not under the path) to my email id. Can u please let me know as... (2 Replies)
Discussion started by: OSD
2 Replies
Login or Register to Ask a Question