| | |
Please help!! Related to making changes in file.
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2007
Posts: 35
Reputation:
Solved Threads: 0
Hi all,
The scenario is like this: i have one file which contains some particular paths, now my aim is to make changes in this file so that i can change the path in that file.. eg:
file1.txt:
ABC
-p /home/user/a/b/v23.9/library -l /home/user/a/b/ABC/v23.9 test.exe
DEF
-r v23.9 /c/d/f -p /home/user/a/b/v23.9/library -l /home/user/a/b/ABC/v23.9 test.exe
end of file1.txt
now i want to change only this 'v23.9' to 'abcde' that to only in both the paths.
I tried using "tr" but it changes all the v23.9 in this file.
Can anyone please suggest me any solution.
Thansk
The scenario is like this: i have one file which contains some particular paths, now my aim is to make changes in this file so that i can change the path in that file.. eg:
file1.txt:
ABC
-p /home/user/a/b/v23.9/library -l /home/user/a/b/ABC/v23.9 test.exe
DEF
-r v23.9 /c/d/f -p /home/user/a/b/v23.9/library -l /home/user/a/b/ABC/v23.9 test.exe
end of file1.txt
now i want to change only this 'v23.9' to 'abcde' that to only in both the paths.
I tried using "tr" but it changes all the v23.9 in this file.
Can anyone please suggest me any solution.
Thansk
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Hey there did you try tr and specify only alpha characters?
Hope that helps
, Mike
Shell Scripting Syntax (Toggle Plain Text)
tr '[:upper:]' '[:lower:]'
Hope that helps

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
•
•
Join Date: Jul 2007
Posts: 35
Reputation:
Solved Threads: 0
•
•
•
•
Hey there did you try tr and specify only alpha characters?
Shell Scripting Syntax (Toggle Plain Text)
tr '[:upper:]' '[:lower:]'
Hope that helps
, Mike
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Can you post your code and the resulting output?
Thanks
, Mike
Thanks

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Assuming you mean the v23.9 directly after the -p argument
If you mean after the -p and after -l arguments then
Shell Scripting Syntax (Toggle Plain Text)
sed -e 's;/v23.9/;/abcde/;g' file1.txt > file2.txt
If you mean after the -p and after -l arguments then
Shell Scripting Syntax (Toggle Plain Text)
sed -e 's;/v23.9;/abcde;g' file1.txt > file2.txt
Last edited by masijade; Jan 18th, 2008 at 3:46 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
Similar Threads
- Making Master Detail Combo Boxes in Asp.net work without post back (ASP.NET)
- What's better? Windows 2000 Server or Linux Server? (Windows Servers and IIS)
- Could not load File or Assembly - X300-SE problem? (Windows NT / 2000 / XP)
- Windows File Explorer and Related Objects Would NOT Open! (Viruses, Spyware and other Nasties)
- I am auctioning one copy of my unique monetization concept with file hosting site (Websites for Sale)
- I have two question related to C++ (C++)
- Creating a Hosts File Pointers. . .Entry Level (Windows 95 / 98 / Me)
- Highjack file Ie wont download (Viruses, Spyware and other Nasties)
Other Threads in the Shell Scripting Forum
- Previous Thread: problem with relative pathing
- Next Thread: variable assignment and sed in bash script
| Thread Tools | Search this Thread |






