Shell script request


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script request
# 1  
Old 04-02-2012
Shell script request

I've a master file which will contain 100 file names, The script should read file name from a master file and format the file as below in AIX.

input file

Code:
Filename

This
is
a
test
file

Output File

Code:
Filename|This is a test file

Thanks in advance


Code:
for file in $FileList; do 
echo $file; 
FileName=`basename $file`; 
sed  's/^M//g' $file> "${file}"2;
mv "${file}"2 "${file}"; 
sed '1d'  "${file}" >"${file}"1; 
mv "${file}"1 $file; 
sed 's/^$/|/'|tr "\n\r" "  " > "${file}"1
mv "${file}"1 $file; 
done

This is doing nothing. I'm not good at sed. Please help.

Last edited by methyl; 04-02-2012 at 01:42 PM..
# 2  
Old 04-02-2012
what have you tried? where do you need help?
# 3  
Old 04-02-2012
What Operating System and version do you have? What Shell do you use?

You seem to refer to ^M a lot (which I interpret as intending to mean ctrl/M or carriage-return).
Is the input file a Microsoft format text file with carriage-return line-feed at the end of each line? Or is this a normal unix text file with just line-feed at the end of the line. Or is this an old MAC format text file with carriage-return at the end of each line?

Does Filename occur at the top of each file called Filename?
# 4  
Old 04-02-2012
Hi

I'm using bash shell in AIX 6.1
^M microsoft text
Yes its a Microsoft format text file with carriage-return line-feed at the end of each line

No the file name I've mentioned in example will be a free test like "Null in a Not Null column" or "0 Length Char". This will be standard in all files.
# 5  
Old 04-02-2012
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.
# 6  
Old 04-02-2012
Duplicate topic, continue here.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies

2. Shell Programming and Scripting

Get Parameter with Shell request

How can I get Parameters with Shell Request. I mean so but not work: PHP: error_reporting(E_ALL); $hallo ="Hallo Welt"; print_r(shell_exec("sh client.sh $hallo")); Shell: echo $hallo echo ceck (5 Replies)
Discussion started by: Linuxmann
5 Replies

3. Shell Programming and Scripting

Shell program request to download .pdf files

Hello, Would you suggest me a shell program that would launch the given url and if there is login we have enter the credentials. If the credentials are correct it would be redirected to home page of that url, the program will check if there are any PDF'S found automatically the PDF'S have... (5 Replies)
Discussion started by: pandu19
5 Replies

4. Shell Programming and Scripting

Shell program request

Hello, I'm requesting the shell program to compare 2 .csv files which will have large data. Can any one help me with this linux shell program Thanks in advance. Thanks and regards Ramanjaneya. K (1 Reply)
Discussion started by: pandu19
1 Replies

5. UNIX for Dummies Questions & Answers

Script shell calculate mean arrival request duration

hello, I have implemented this command : tshark -eth0 -T fiels -e frame.time et sip.Request-Line -z sip,stat > test2.txt the result of this command : test.txt: Aug 27, 2013 23:06:47.334270000 INVITE Aug 27, 2013 23:06:47.335045000 SIP/2.0 401 Unauthorized Aug 27, 2013... (1 Reply)
Discussion started by: Amouna
1 Replies

6. Shell Programming and Scripting

Request for shell script for listing directories, subdirs containing specific files.

I'm looking for a script which outputs the list of directories and sub directories from root level consisting of specific files. For instance I want shell script to list all the directories and subdirectories containing .txt files.:wall: (4 Replies)
Discussion started by: super210
4 Replies

7. Shell Programming and Scripting

Calling a request set from Unix shell Script

Hi All, I want to call a concurrent request set from a shell script. I am getting the syntax error "syntax error at line 417 : `(' unexpected" in the below script. v_request_id=fnd_request.submit_request(application => 'APPL_SHORT_NAME' ,program => 'PROGRAM_SHORT_NAME' ... (4 Replies)
Discussion started by: swatipevekar
4 Replies

8. Shell Programming and Scripting

Shell Script to provide "answers" to SSL Cert Request

Hello, I need assistance with creating a shell script to generate SSL Certificate Requests on remote hosts. Below is my stab at this, but I cannot figure out how to pass the requested arguments into the openssl command correctly. I have a major problem with redirecting the "answers" into the... (2 Replies)
Discussion started by: azvelocat
2 Replies

9. Shell Programming and Scripting

How cgi(shell script) to receive the URL REQUEST from Front end (visual C++)?

I am facing a problem which is weblogic convert to CGI method. The original process is -> the Front End is using Visual C++, and backend is using WEBLOGIC the based programming is JAVA. The method for Weblogic to receive the request from Front end (Visual C++) thru URL. for example :... (0 Replies)
Discussion started by: ryanW
0 Replies
Login or Register to Ask a Question