Align data of the paragraph


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Align data of the paragraph
# 1  
Old 06-11-2015
Align data of the paragraph

Hi,

I need your help to align data from paragraph.
It's to :
- delete the lign contain NDS
- align data between paragraph start to "ND=" from second "ND="

example of file:

Code:
@
ABOIL;

@
CEN=1/15-05-23/09 H 06 MN 18/LISTAGE CARACTERISTIQUES D'ABONNES
TRAITEMENT TGLAIL ACC
ND=31630000 NE =001-19-111 TAX = 00077947
TY= KLA+ SR4
CAT= IAM+ FD3+ RVT+ SRC+ CAM2+ IAI
MAR=ATT
ND=36851217 NE =027-07-011 TAX = 00000000
TY= KLA+ SR1
CAT= FD3+ SRC+ DAD1+ CAC14+ ZTX14+ ZG14
NDS=31656756 ND=31653755 
NDS=31656757 ND=31653755 
TRAITEMENT TGLAIL EXC

result of the script:

Code:
31630000;001-19-111;;;00077947;KLA+SR4;IAM+FD3+RVT+SRC+CAM2+IAI;ATT
31633161;002-13-115;;;00006845;KLA+SR1;FD3+DF2+SRC+DAD1+RVFO+RFNR;ARFO+ARFN
31651448;001-12-117;;;00000000;KLA+SR1;FD3+SRC+DAD1+RVFO+RFNR;ARFO+ARFN
31630003;;;;;;DF3;
35905483;028-05-076;;;00000000;KLA+SR1;FD3+SRC+IAI+DAD1+DIPA;ATT


Last edited by Don Cragun; 06-11-2015 at 03:35 PM.. Reason: Added code tags; drop COLOR tags.
# 2  
Old 06-11-2015
If you want help with this, you need to provide a much better description of your input and output file formats!

You said you want to delete lines containing NDS. You didn't say anything about deleting lines containing @, TRAITEMENT, etc.

There is no description of why some spaces are to be removed, why some tag=data sets are joined on lines and some are on separate lines. Especially with the varied spacing around the equal signs, it isn't obvious whether or not something that looks like a tag in the middle of a line is a tag or is data for an earlier tag on the same line.

There is no description of what data should be directed to some of the output fields. (Some fields are always empty. Is this because the tags for the wanted data are not present in your sample, or because that field is always supposed to be empty?)

What shell and operating system are you using?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Align columns

I have a text file that I filtered using awk. I only exctracted two columns. I want those two columns to be aligned. Most of the answers I found was to use `column -t` command. I tried that but I am getting a `bash: column: command not found`. Is there another way to align columns... (1 Reply)
Discussion started by: erin00
1 Replies

2. Shell Programming and Scripting

Re align in one row using sed

Hi, Anyone can help on how to re align my data in one row using sed. test.csv "url1","abc","project url1" 2016-08-16 "url2,"microsoft","project url2" 2016-08-18 need output like this "url1","abc","project url1","2016-08-16" "url2,"microsoft","project url2","2016-08-18" Thanks in... (8 Replies)
Discussion started by: fspalero
8 Replies

3. Shell Programming and Scripting

Align input fields on one under each other

Hello again, I'm having a issue with a contact form. I want the input fields to be aligned on same row and I really dont know how to do it. I attached a image for you to understand what i am trying to do. <BR> <label for="name" class="required"> Name&nbsp;<strong... (1 Reply)
Discussion started by: galford
1 Replies

4. Shell Programming and Scripting

Align columns

Hi, I have a question on how to align columns in shellscipt. SAMPLE 2015-07-15 09:01:00.0 |TCSERVER01 |10965 2015-07-15 09:02:00.0 |TCSERVER01 |4752 2015-07-15 09:03:00.0 |TCSERVER01 |4805 2015-07-15 09:04:00.0 |TCSERVER01 |3690 2015-07-15 09:01:00.0 |TCSERVER02 |8703 2015-07-15... (1 Reply)
Discussion started by: reignangel2003
1 Replies

5. Shell Programming and Scripting

Align with printf or other method

below line is one by one print audio_play PASS boot_check FAIL ethernet_change_mac NIC_82574L PASS gps_ublox_neo FAIL storage_bonnie USB2 PASS storage_copy_big_file USB2 PASS I would like below format ... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

6. Shell Programming and Scripting

Compare 2 files and match column data and align data from 3 column

Hello experts, Please help me in achieving this in an easier way possible. I have 2 csv files with following data: File1 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:36:09,JOB_5340 08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350 08/23/2012... (5 Replies)
Discussion started by: asnandhakumar
5 Replies

7. Shell Programming and Scripting

Align or move paragraph right

Hello I am a newbie in scripting and I am hoping someone may help with a method of aligning or tabbing selected text as its output. For example, using the SED command to extract paragraphs containing AA BBB CCC sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;/BBB/!d;/CCC/!d' How could I say, get the... (18 Replies)
Discussion started by: lostincashe
18 Replies

8. Shell Programming and Scripting

Align the words

HI , I am new to shell scripting i m getting the below format like this Name FirstName Lastname ------ --------- ---------- Name1 Balaji NandaKishore Name123 Vijaya krsihna ... (5 Replies)
Discussion started by: Lucky123
5 Replies

9. UNIX for Dummies Questions & Answers

Output text from 1st paragraph in file w/ a specific string through last paragraph of file w/ string

Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string. Previously, I was outputting just each paragraph with that search string with: cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
Discussion started by: carpenn
2 Replies

10. Shell Programming and Scripting

To Align clinical data files using awk

Hello, I am new to shell scripts and 1st week into awk. I have so far managed to format output files to sample File 1 and File 2 as shown below and File 3 output solution is what I am looking for...thanks File 1: 0633-009_001200008:225065338468009:CMBRTRM:albuterol... (4 Replies)
Discussion started by: chowdhut
4 Replies
Login or Register to Ask a Question