Parsing Files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parsing Files
# 1  
Old 04-12-2008
Parsing Files

I have two text files. I need to parse the data. It's names of file and I am using it to rename files. I have file1 containing the original file name and file2 containing the renamed name of the file. I need to parse them together in one file, which will be easy to use the mv command.

This is what I want it to do:

file1:

[a-s]_Test.txt


file2:

Test.txt

The end result should be...

file3:

[a-s]_Test.txt Test.txt

----------------------
I believe I need to do variable substitution or is there a better way to do it? Currently, I am using C shell.
# 2  
Old 04-12-2008
Code:
paste file1 file2 > file3

Jean-Pierre.
# 3  
Old 04-12-2008
Thanks aigles. Well, this is going beyond what I had asked before I am pretty new to Shell Scripting. _-" Now I have to figure how to redirect the input from the text file...
# 4  
Old 04-12-2008
The following command renames the files :
Code:
paste file1 file2 | xargs -L 1 mv

Jean-Pierre.
# 5  
Old 04-13-2008
Thanks I figured it out. ^^

Well, I have a different version of xargs. It didn't have the option L. However, it used n for arguments.

So, it turned it out to be.

Code:
paste file1 file2 | xargs -n 2 mv

Now I have to work to clean up my code and make the second part of the script. ^^ Thanks a lot. :P
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing large files in Solaris 11

I have a 1.2G file that contains no newline characters. This is essentially a log file with each entry being exactly 78bits long. The basic format is /DATE/USER/MISC/. The single uniform thing about the file is that that the 8 character is always ":" I worked with smaller files of the same... (8 Replies)
Discussion started by: os2mac
8 Replies

2. Shell Programming and Scripting

Parsing through list of files

I have a requirement where I need parse through files in a directory which have a specific pattern and then check whether the file has been processed or not. The exit condition is any file that has been processed will have an entry in database. If it is processed i.e., if an entry is present for... (4 Replies)
Discussion started by: abhilashnair
4 Replies

3. Shell Programming and Scripting

Parsing xml files

I want to search for all the xml files on the server that have "Status" in them. Is this the correct code that I should use? Can anyone explain exactually what this code does? xmlFileNames=$(find . -name "*.xml" -exec grep -l ".*Status" {} \; 2>/dev/null) (9 Replies)
Discussion started by: emc^24sho
9 Replies

4. UNIX for Dummies Questions & Answers

Really need some help with Parsing files by date

Hi, I am new to Unix and need some help with a problem I have. I have been asked to ftp a file(s) from a directory to another system. I need to be able to allow the current days file to build and only send any other file across that is in the directory. I need a peice of code that will read... (3 Replies)
Discussion started by: darrenwg99
3 Replies

5. Shell Programming and Scripting

Parsing files depending on the content

I am trying to parse files kkapjil kkpcjil kkexjil ...which have autosys job names. The objective is to parse each file...do an autorep -j <job name > -q and write it as output with a line for condition at the end of the each job. The problem I am facing is with the box jobs...as autorep -j <box... (0 Replies)
Discussion started by: w020637
0 Replies

6. Shell Programming and Scripting

Help: Parsing a file to new output files

I have an output file similar to this >HWI-ST766:129:D0WJDACXX:4:2308:16645:199681.1 /start=1 /end=100 /strand=+ Eukaryotic18S_rRNA GATTAAGCCATGCATGTGTAAGTTTAAAGTCCTAGAAGGATGAAACTGCGGACGGCTCAT TATAACAGTAATAGTTTCTTTGGTTAGTATCTATAAGGAT >HWI-ST766:129:D0WJDACXX:4:2308:2922:199946.1 /start=1... (4 Replies)
Discussion started by: fozrun
4 Replies

7. Shell Programming and Scripting

Parsing all the files in the directory and replacing them

Hi, I would like to parse all the files (*.c and *.h) in the sub-directories and if *.c or *.h files are found I would like to append a string and place it in the same directory. How do I do that? For example: I'm gonna operate on dir1 level. $dir1/subdir1/test.h should be done as... (1 Reply)
Discussion started by: suryaemlinux
1 Replies

8. Shell Programming and Scripting

Parsing and sum column from different files

Hy everybody, I have three file with the same formating. I need to parse those files in order that for each first column of the first file, sum the second columns of first,second and third files. Can someone help me ? example : # more file1 00:00:12,137;7,0333333 # more file2... (6 Replies)
Discussion started by: robdcb
6 Replies

9. Shell Programming and Scripting

Parsing files

Hi I have code to parse a properties file (${name}) and put the letters 'XxxX' on the end of each line that has an '=' sign in it. See bellow: sed -e '/=/s/,/XxxX,/' -e '/=/s/$/XxxX/' "${name}" >"${RESULT}" I want to change this so that it will ONLY do this to lines the DON'T end in... (2 Replies)
Discussion started by: jascas
2 Replies

10. Shell Programming and Scripting

parsing files

I have a large file that needs to be weeded through every month. The file has events that go back forever, but on a monthly basis I need to look thru the last months worth of data. Is there a best way to get the script to know where it left off last time it read the file, like maybe putting a... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
Login or Register to Ask a Question