Okay we've got past one very common scripting problem ("for" vs "while").
Back to the Microsoft text file format problem in your data files (imho).
I believe that your display format is all over the place because the input data contains carriage-return characters (or some other weird control codes which do not belong in a unix text file) and you have in places deleted line-feed characters (the standard unix text file line terminator). Therefore I believe that what you are seeing on the screen is only part of the output from your script because the screen driver is actioning these rogue control codes.
Back to an earlier request. We need to see a sample .svn/entries file displayed in a manner where we can see control codes:
For example:
Also, please post the current version of the script. I can't see anything in the most recent version posted which writes to a file (unless you are referring to a saved file from "script").
We'll come back to the code at the bottom of post #24 if necessary, but I for one can't follow it!
I suspect that the higlighted file(s) contain control codes which should not be in a unix text file. Most likely carriage-return characters from a Microsoft computer. Post #19 does not show a sample of one of these files.
Just need to confirm this fact by making the control codes visible. This could equally be done with the unix "od" command but that "sed" command is a quick and easy way of seeng the bad characters.
I sent this output once before the first time I was asked (remember I only grep'ed for the hostURL)
sample of Subversion metadata output from code above only interested in the hostname
Environment:
All directories used were copied from a Windows Server to a Linux Server to extract the data for the script I am trying to build, I do not know DOS so I thought I could use ksh scripting to create the script for the mass relocation of the Subversion Working Copies (WC). The only way to differentiate a directory that contains a Subversion WC ( a directory that contains data checked out from Subverion) is that the directory contains a .svn(dotsvn) directory.
The .svn(dotsvn) directory contains a file "entries", the "entries" file contains metadata for the WC , it (entries) contains the URL to the host where the repository is located that contains the data that was checked out and copied to the WC directory.
Relocation - The server that contains the Subversion Repositories (OldRepo) from which the WC came has been migrated to another server along with the Repositories (NewRepo).
What needs to happen is the Subversion relocate command (svn relocate) needs to be executed in each directory that contains the .svn(dotsvn) directory.
the command string is
In order to create the "final script" the following is required:
1) Make a list of all the directories that contain the .svn(dotsvn) subdirectory ( this is a hidden file to windows, another reason to use Linux ksh)
Master Script
# Run script that create final script for the svn relocate command for each working copy found. <---What we have been working on --->
createRelocwc.sh (with comments added here)
So here we are again
---------- Post updated at 07:27 AM ---------- Previous update was at 07:21 AM ----------
Note I am not interested in listing the path if the "entries" file contains a different host than whats in the script. The only purpose for the "entries" file is to see if it contains the correct host name nothing more the file is not used for anything else
---------- Post updated at 07:35 AM ---------- Previous update was at 07:27 AM ----------
The problem I see is listing the directory path in another file when the directory PATH contains a Directory Name that contain spaces. ok in Windows I guess but not in Linux.
Example:
windows cd /windows/program files puts you in the program files directory
linux cd /windows/program files seem to try and put you in a directory called program
so the file created by the script gives cd /windows/program not what it should be /windows/program files/
I even tried putting quotes around like "/windows/program files/data" in the first file
but when adding the cd via echo in the script it still drops the path at "/windows/program
so I wind up with
cd /windows/program
cd /files/data
which is not what I want
Last edited by methyl; 02-23-2012 at 09:48 AM..
Reason: remove 922 line double paste ; fix some code tags
#!/bin/ksh
############################################################
# This script creates the script to relocate DNAbuild working copies from #
# the Solaris svn01g.gdc.net server to the svnprod.nwie.net server. #
############################################################
#
#Run the script to collect all DNA working copy locations ( find the .svn directories )
ScriptLoc="/home/scripts"
OutputLoc="/home/scripts/dataout"
bldDirLoc="/webdata/tmpDNAbld/"
cd ${bldDirLoc}
find . -type d -exec sh -c '[ -d "$1"/.svn ] || exit 1' sh {} \; -print | cat > ${OutputLoc}/dnaRelwc1.txt
#sort file and remove ./ from the beginning of each line
`cat ${OutputLoc}/dnaRelwc1.txt` | sort -u | sed '$!N; /^\(.*\)\n\1$/!P; D' | sed 's/^.\{2\}//g' | cat > ${OutputLoc}/dnaRelwc1.dat
FIRST SCRIPT last line does not work at all (due to the backticks) and appears to write to the input file dnaRelwc1.dat when the next script actually reads dnaRelwc2.dat.
Perhaps you meant:
Hi Guys,
I was scratching my head for this for half a day... finally not successful :confused:
Following is the problem
I have a variable
$ var1=123
$ var2-234
$ var3=345
and another Variable
$ i=1
Now i wanted to save these into a Variable as shown below
for i in 1 2 3
do... (5 Replies)
Hi Friends ,
I want to know how to format the output for the following:
i searched in the forum and couldnt get the exact requirement.
Thanks in advance . (2 Replies)
I need to know how to concatenate variables in Debian. I am making a interactive script where it ask the user for info to add a user I pull the first letter from the first middle and last name into individual variables now i want to put them all in one variable so i can put it into useradd command ... (4 Replies)
Hi,
I 'm trying to send an e-mail for every different line in the .txt
for i in {1..$variable}
do
sed -n "/$i$/p" text.txt
done
I have two problems about this.
First one is that for loop doesn't work
and the second one is that i cant get the output of sed (4 Replies)
Hello,
I have a tricky problem:
I have a $file with a variable number of occurrences of "ORA-" (in this case two)
..........
EXP-00008: ORACLE error 3113 encountered
ORA-03113: end-of-file on communication channel
EXP-00056: ORACLE error 1403 encountered
ORA-01403: no data found... (9 Replies)
I can't believe I can't figure this out... given this code:
CARS_DATA_LIST=`cat /tmp/file1 | awk '{print $1}' `
FMSA_DATA_LIST=`cat /tmp/file2 | awk '{print $1}' `
The value of each of the above variables is:
CARS = a b c d e f g
FMSA = a b c q r s
I want to declare a third... (8 Replies)
I'm trying to set a variable to the output of a command.
This is what the comand output to the display looks like:
/>hciconndump -v TOsiu
Dump of connection(s): TOsiu
----------------------------------------------------------------------
Process: A60Tsiu Connection: TOsiu... (2 Replies)
Hi,
I'm new to shell programming.
I have two variables a and b
a=val1
b=val2
could anyone kindly post the shell script to concatenate the values of variable a and b with an underscore(_) in between?
The final output should be val1_val2. (8 Replies)
hi all,
how do i subract variables in shell ?? am trying to space out the headers and the output generated by the shell so they all line up :
currently the output is like this :
servers : users
server1 : 10
latestServer : 50
so i thought... (3 Replies)
I'm new to unix scripting. How would I go about pulling the first 3 characters from a variable in ksh and storing in another variable? Thanks. (9 Replies)