Jul 29, 2004 #1 iribach Technical User Joined Oct 12, 2002 Messages 211 Location CH Code: #n /adr0/,/adrX/p this works perfect, as expected, suppose it prints: Code: aaa bbb ccc Q: how join the output lines to 1 string: like Code: aaabbbccc with endind '\n' ? sed has (maybe i have) problems with '\n' tia
Code: #n /adr0/,/adrX/p this works perfect, as expected, suppose it prints: Code: aaa bbb ccc Q: how join the output lines to 1 string: like Code: aaabbbccc with endind '\n' ? sed has (maybe i have) problems with '\n' tia
Jul 29, 2004 Thread starter #2 iribach Technical User Joined Oct 12, 2002 Messages 211 Location CH PS: no problems doing it in AWK, PERL or C SED is required Upvote 0 Downvote
Jul 29, 2004 #3 stefanwagner Programmer Joined Oct 19, 2003 Messages 2,373 Location DE Code: sed 's/.*$/aaabbbccc/g;q' input works like a charm for real: why only use sed? Is tr allowed? Code: cat abc.file | tr -d "\n" Well - Helmut Herold, "awk und sed", Addison Wesley, 1997, p. 233 says: (sedfile: repnl.sed) Code: /^[a-zA-Z]*$/H /^[a-zA-Z]*$/d H g s/\([a-zA-Z]*\)\n/\1/g sed -f repnl.sed abc.file Don't expect explanation. seeking a job as java-programmer in Berlin: http://home.arcor.de/hirnstrom/bewerbung Upvote 0 Downvote
Code: sed 's/.*$/aaabbbccc/g;q' input works like a charm for real: why only use sed? Is tr allowed? Code: cat abc.file | tr -d "\n" Well - Helmut Herold, "awk und sed", Addison Wesley, 1997, p. 233 says: (sedfile: repnl.sed) Code: /^[a-zA-Z]*$/H /^[a-zA-Z]*$/d H g s/\([a-zA-Z]*\)\n/\1/g sed -f repnl.sed abc.file Don't expect explanation. seeking a job as java-programmer in Berlin: http://home.arcor.de/hirnstrom/bewerbung
Jul 30, 2004 #4 Ygor Programmer Joined Feb 21, 2003 Messages 623 Location GB Code: #n /adr0/,/adrX/H /adrX/{g;s/\n//g;p;d;} Upvote 0 Downvote