Replace new line with path

Thread Tools Search this Thread
Operating Systems Linux Replace new line with path
# 1  
Old 07-18-2011
Replace new line with path


The below is the output of
multipath -ll |grep -i ddn | awk '{print $1}' | tr -s '\n' ','

/dev/mapper # multipath -ll |grep -i ddn | awk '{print $1}' | tr -s '\n' ','

I want to add /dev/mapper/ and make it look like the following:

what can i do to make it work?

# 2  
Old 07-18-2011
Change the AWK component of your pipeline to awk '{print "/dev/mapper/" $1}' or filter your current output through sed 's|[^,]*|/dev/mapper/&|g'.

Regards and welcome to the forum,
# 3  
Old 07-18-2011
Hi Alister,

Thanks a lot for your reply. I just modified the multipath.conf and it came out with different output as you can see the below.

# multipath -ll |grep -i ddn | awk '{print "/dev/mapper/" $2}' | tr -s '\n' ','

I want to make it look like the below:


Can you please help me one more time?

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find and replace the path value in files, pattern is not full known.

Hi, I need to do find and replace, but the pattern is not full known. for example, my file has /proj/app-d1/sun or /data/site-d1/conf here app-d1 and site-d1 is not constant. It may be different in different files. common part is /proj/xx/sun and /data/xxx/conf i want to find where ever... (6 Replies)
Discussion started by: rbalaj16
6 Replies

2. Shell Programming and Scripting

Pattern match a path anywhere in the line and replace it with new path

I want to pattern match only path part from below and replace them with new path string. LoadModule jk_module /fldrA/fldrBaf/fldrCaa/modules/ JkWorkersFile /fldrA/fldrBaf/fldrCaa/config/OHS/ohs1/ JkLogFile... (4 Replies)
Discussion started by: kchinnam
4 Replies

3. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

4. Shell Programming and Scripting

Find and Replace Path in UNIX

Hi All, How can i find and replace the one path to another path with in the file. For Example: Search_path=/search/path replace_path=/replace/path I used the following command but not usefull, please help me regarding the same. sed 's_/search/path_/replace/path_' file_name >... (6 Replies)
Discussion started by: nsyed.dw
6 Replies

5. Shell Programming and Scripting

find and replace a path with sed?

Hi, I am attempting to find the path /subject/grin* and replace it with /subject/$i My attempt: for i in $(ls) do sed -e 's:"/subjects/grin.*":"/subjects/$i.*":g' and several variants with no luck. Please help. Thanks! (8 Replies)
Discussion started by: JC_1
8 Replies

6. Shell Programming and Scripting

To replace a keyword for a number of files in a path

I have to search for a keyword (UTF-16) in xml file and if the keyword is found i have to convert the encoding type in the file to UTF-8 and then replace the keyword inside the file from UTF-16 to UTF-8. I have the code which is working for one file but for number of files in a path its not... (2 Replies)
Discussion started by: Shruthi8818
2 Replies

7. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

8. Shell Programming and Scripting

Replace a filename with full path using sed

hi, i need to replace a line a file with a new raw device location.. original file.. /opt/sybase/ASE1502/ASE-15_0/bin/dataserver \ -d/data/TST_AKS1/sybdevices/master.dat \ -e/logs/sybase/TST_AKS1/SFO_TST_AKS1.log \ -c/apps/sybase/ASE1502/ASE-15_0/TST_AKS1.cfg \... (2 Replies)
Discussion started by: aksaravanan
2 Replies

9. Shell Programming and Scripting

Replace path in a file with dot

Hi, I have a file with below values. /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv.orig /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.cshrc /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.login... (3 Replies)
Discussion started by: njoshi
3 Replies

10. Shell Programming and Scripting

Replace a Directory path with another in a file

Hi, I have abt 20-30 scripts using a directory structure. I have to replace a directory structure in a file for example "/i01/proc" with "/dwftp/scripts" using sed. The command :- cat filename | sed 's/"i01/proc"/"dwftp/scripts"' is not working. Can someone help me in this regard? ... (3 Replies)
Discussion started by: venkatajay_18
3 Replies
Login or Register to Ask a Question