Sponsored Content
Top Forums Shell Programming and Scripting to join the corresponding lines using shell commands or awk Post 302150067 by vgersh99 on Monday 10th of December 2007 02:27:45 AM
Old 12-10-2007
Given your 'simplified' sample input above, this is what I get with the script:
Code:
gi_1 ABCDEFDHIJ KMNOPQRSTU VWXYZABCDE FGHIJKLMNO PQRSTUVWXY ZABCDEFABC
gi_2 JKLMNOPQRS TUVWXYZABC DEFGHIJKLM NOPQRSTUVW XYZABCDEFG HIJKLMNOPQ
gi_3 PQRSTUVWXY ZABCDEFGHI JKLMNOPQRS TUVWXYZABC DEFGHIJKLM NPQRSTUVWX
gi_4 CDEFGHIJKL MNOPQRSTUV WXYZABCDEF GHIJKLMNOP QRSTUVWXYZ ABCDEFGHIJ
gi_5 IJKLMNOPQR STUVWXYZAB CDEFGHIJKLM NOPQRSTUVW XYZABCDEFG HIJKLMNOPQ

If you're not seeing the same results, try changing:
Code:
RS=""

TO
Code:
FS=RS
RS=""

Your awk might be different from mine.........

Last edited by vgersh99; 12-10-2007 at 03:34 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk Join multiple lines

Hi, I have data with broken lines: Sample data: "12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50" "16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|" 2453748"|"08:15:50" "16"|"25"|"a"|"b"|" c"|"d"|"e"|"f"|"2453748"|"08:19:50" "16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50" In the... (5 Replies)
Discussion started by: hitmansilentass
5 Replies

2. UNIX for Dummies Questions & Answers

Join 2 files with multiple columns: awk/grep/join?

Hello, My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns: File A: (tab-delimited) PDB CHAIN Start End Fragment 1avq A 171 176 awyfan 1avq A 172 177 wyfany 1c7k A 2 7... (3 Replies)
Discussion started by: InfoSeeker
3 Replies

3. Shell Programming and Scripting

How to get awk to edit in place and join all lines in text file

Hi, I lack the utter fundamentals on how to craft an awk script. I have hundreds of text files that were mangled by .doc format so all the lines are broken up so I need to join all of the lines of text into a single line. Normally I use vim command "ggVGJ" to join all lines but with so many... (3 Replies)
Discussion started by: n00ti
3 Replies

4. Shell Programming and Scripting

Using shell commands in awk

Hi, I've searched this site and the wider web and have not found anything (that I can understand..) that helps me. I've used shell commands in awk fine in the past, the difference is that I want to pass the shell command a field variable within awk from the current input. A simple example... (3 Replies)
Discussion started by: Ronnie717
3 Replies

5. UNIX for Dummies Questions & Answers

How to use shell commands within awk?

Hey guys i want to use shell commands like ls, find, cd and more with in awk statements with inputs from the awk variables. Like in the below code how can i change the directory using the value of path. Please suggest awk '{ while (i<NR) { i++; percentage = $5; path = $6; ... (2 Replies)
Discussion started by: rishi90
2 Replies

6. Shell Programming and Scripting

Join lines using sed or awk

Hi, I have text file that looks like this: blabla bla PATTERN LINE1 LINE2 bla bla bla PATTERN LINE1 LINE2 bla PATTERN LINE1 LINE2 bla (9 Replies)
Discussion started by: hench
9 Replies

7. Shell Programming and Scripting

awk join lines based on keyword

Hello , I will need your help once again. I have the following file: cat file02.txt PATTERN XXX.YYY.ZZZ. 500 ROW01 aaa. 300 XS 14 ROW 45 29 AS XD.FD. PATTERN 500 ZZYN002 ROW gdf gsste ALT 267 fhhfe.ddgdg. PATTERN ERE.MAY. 280 PATTERRNTH 5000 rt.rt. ROW SO a 678 PATTERN... (2 Replies)
Discussion started by: alex2005
2 Replies

8. UNIX for Beginners Questions & Answers

Sed/awk join lines once pattern found

Hi all OS - RHEL6.4 I have input file -f1.txt I need to search line which starts with \Start and read next line till it gets blank line and join them all. I need to trim any trailing spaces for each line.So output.txt should be.. \Start\now\fine stepwatch this space for toolsends... (7 Replies)
Discussion started by: krsnadasa
7 Replies

9. Shell Programming and Scripting

awk or a combination of commands to read and calculate nth lines from pattern

Two numerical lines, found by either header line, need to be added and the total placed in a new-header section. Also the total should should be rounded or cut to a two decimal anynumber.XX format with the AB string added on the end. For example: The numerical lines from headers 2 and 3 are... (3 Replies)
Discussion started by: jessandr
3 Replies

10. Shell Programming and Scripting

Join, merge, fill NULL the void columns of multiples files like sql "LEFT JOIN" by using awk

Hello, This post is already here but want to do this with another way Merge multiples files with multiples duplicates keys by filling "NULL" the void columns for anothers joinning files file1.csv: 1|abc 1|def 2|ghi 2|jkl 3|mno 3|pqr file2.csv: 1|123|jojo 1|NULL|bibi... (2 Replies)
Discussion started by: yjacknewton
2 Replies
DIALTEST(8)						      System Manager's Manual						       DIALTEST(8)

NAME
dialtest - HylaFAX dial string processing rules test program SYNOPSIS
/usr/sbin/dialtest [ options ] dialrules DESCRIPTION
dialtest is an interactive program for the testing and development of dial string processing rules used by HylaFAX. dialtest reads the file of rules specified on the command line and then prompts for a dial string. For each string typed in, dialtest prints the result of applying the canonicalization and dial-string preparation rule sets. A rule set whose name is setname can be specified by typing ``set- name(string)''; for example, ``CanonicalName(+1.415.965.7824)''. Note that dialtest reads the rules file only when it is initially started up. This means that dialtest must be restarted for it to apply changes to a rules file. OPTIONS
-a code Use code as the value of AreaCode in the rules file. The default area code is ``415''. -c code Use code as the value of CountryCode in the rules file. The default country code is ``1''. -i prefix Use prefix as the value of InternationalPrefix in the rules file. The default international dialing prefix is ``011''. -l prefix Use prefix as the value of LongDistancePrefix in the rules file. The default long distance dialing prefix is ``1''. -q Be quiet, suppressing most all output except for the actual results. This is useful for using dialtest in an automated fashion. -v Print each input line before displaying the results of applying the dial string rules to the input string. This can be useful, for example, in shell scripts. SEE ALSO
dialrules(5) March 3, 1995 DIALTEST(8)
All times are GMT -4. The time now is 03:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy