two lines into one colon separated line...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting two lines into one colon separated line...
# 1  
Old 03-30-2005
two lines into one colon separated line...

Does anyone know how to get these two output lines into one colon ':' separated line with some unix command? Maybe nawk. I've tried to read the nawk and awk man pages but I don't get it right. Are these commands the one to use?

Output from find command:
#
/sw/tools/matlab/7.0.1/man
/sw/tools/gnat/5.01a/man
#

I would like to get it like this:

/sw/tools/matlab/7.0.1/man:/sw/tools/gnat/5.01a/man

Is awk the command to pipe the output to, and if so, how can I solve this?


Thanks to You that replys...
# 2  
Old 03-30-2005
find ..... | tr '\n' ':'

or with nawk:
find ..... | nawk -v ORS=':' '1'
# 3  
Old 03-30-2005
Great!! -Thanks... You saved my day.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete all lines without a trailing semi colon

shell : bash os : RHEL 7.2 I have a file like below 61265388 1-11Y5C-7690 1-11Y4Q-6763 INSERT INTO emp VALUES('oramds:test.xref','CBS_01','MIGWO161265388','61265388','N',SYSDATE); INSERT INTO emp VALUES('oramds:test.xref','COMMON','MIGWO161265388','MIG1COMMON61265388','N',SYSDATE);... (3 Replies)
Discussion started by: kraljic
3 Replies

2. UNIX for Dummies Questions & Answers

awk colon separated items

Hi, I need to filter my data based on items in column 23. Column 1 until column 23 are tab separated. This is how column 23 looks like: PRIMARY=<0/1:504:499,5:.:.:.:0.01:1:15:.> I want to extract lines if items 7 (separated by : ) in column 23 are more than 0.25 . In example above , item... (2 Replies)
Discussion started by: janshamsani
2 Replies

3. Shell Programming and Scripting

Combining multiple block of lines in one comma separated line

Hi Everyone, On my Linux box I have a text file having block of few lines and this block lines separated by one blank line. I would like to format and print these lines in such a way that this entire block of lines will come as single comma separated line & again next block of lines in next... (7 Replies)
Discussion started by: gr8_usk
7 Replies

4. Homework & Coursework Questions

C++ Attempting to modify this function to read from a (;) semi-colon-separated file

After some thought. I am uncomfortable issuing my professors name where, there may be unintended side effects from any negative responses/feedback. Willing to re post if I can omit school / professor publicly, but can message moderator for validation? I am here for knowledge and understanding,... (1 Reply)
Discussion started by: briandanielz
1 Replies

5. Shell Programming and Scripting

Count lines separated by new line

Hi guys, I have a file which has random records like mentioned below emcpower28a pci@3,03 (disk physical name) pci@3,04 emcpower9a pci@1,03 pci@2,03 pci@3,01 pci@4,03 there could be any number of disk names for any LUN (emc...) So, I want a solution to count disk names for its... (12 Replies)
Discussion started by: prashant2507198
12 Replies

6. Shell Programming and Scripting

awk :help to parse a file to change to separated by colon ":"

Hi experts , I am trying to get the below output: file : 0/6/4/1 0x0019503C2E26 5 UP lan5 snap5 1 ETHER Yes 224 0/6/4/0 0x0019503C2E25 6 UP lan6 snap6 2 ETHER Yes 224 0/2/1/0 0x0019503E6900 0 UP lan0 snap0 3 ETHER Yes 224... (8 Replies)
Discussion started by: rveri
8 Replies

7. Shell Programming and Scripting

How to sort a column in UNIX that is colon separated ":" ?

Experts, how to sort this fields with numerical order : -How to use the sort command in this case, I was thinking with -k but it is not working, lan5000 lan5000:1 lan5000:10 lan5000:11 lan5000:12 lan5000:13 lan5000:14 lan5000:15 lan5000:16 lan5000:17 ... (6 Replies)
Discussion started by: rveri
6 Replies

8. Shell Programming and Scripting

Print pipe separated list as line by line in Korn Shell

Korn Shell in AIX 6.1 I want to print the below shown pipe (|) separated list line by line. line=es349889|nhb882309|ts00293|snh03524|bg578835|bg37900|rnh00297|py882201|sg175883 for i in line do echo "Hello $line " done I wanted to execute the above for loop. But i can't even set the... (3 Replies)
Discussion started by: polavan
3 Replies

9. Shell Programming and Scripting

Running multiple commands stored as a semi-colon separated string

Hi, Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g., # vs="echo a; echo b;" # $vs a; echo b; I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using... (2 Replies)
Discussion started by: svhyd
2 Replies

10. Shell Programming and Scripting

Separate lines in a single '|' separated line

Hi I have a file with contents like china india france japan italy germany . . . . etc.... I want the output as china|india|france|japan|italy|germany|.|.|. (3 Replies)
Discussion started by: hidnana
3 Replies
Login or Register to Ask a Question