Sponsored Content
Full Discussion: Formatting a file
Top Forums Shell Programming and Scripting Formatting a file Post 302736365 by maverick_here on Tuesday 27th of November 2012 06:13:51 AM
Old 11-27-2012
Formatting a file

Hi Experts

I have a file which looks as follows

Code:
acttest         /report/fieldsinf/acttest/LIVE/acttest          Chris New
teatin1         /report/fieldsinf/eatin1/TEST/teatin1           Chris New
eatin1          /report/fieldsinf/eatin1/LIVE/eatin1             Chris New
tbectest                /report/fieldsinf/bectest/TEST/tbectest         Chris New
atptest         /report/fieldsinf/atptest/LIVE/atptest          Chris New
tap1201p                /report/fieldsinf/ap1201p/TEST/tap1201p         Tom Hanks
ap1201p         /report/fieldsinf/ap1201p/LIVE/ap1201p          Tom Hanks
tap6re2m                /report/fieldsinf/ap6re2m/TEST/tap6re2m         Sara Johan
tap1204m                /report/fieldsinf/ap1204m/TEST/tap1204m         Sara Johan
ap1204m         /report/fieldsinf/ap1204m/LIVE/ap1204m          Sara Johan
tap1205m                /report/fieldsinf/ap1205m/TEST/tap1205m         Sara Johan
taptestm                /report/fieldsinf/aptestm/TEST/taptestm         Sara Johan
aptestm         /report/fieldsinf/aptestm/LIVE/aptestm          Sara Johan
aptesty         /report/fieldsinf/aptesty/LIVE/aptesty          Sara Johan
tap6krep                /u/fieldsinf/ap6krep/TEST/tap6krep              Rob Flicker
tap6kidp                /report/fieldsinf/ap6kidp/TEST/tap6kidp         Rob Flicker
tap1207m                /u/fieldsinf/ap1207m/TEST/tap1207m              Rob Flicker
tap6krem                /u/fieldsinf/ap6krem/TEST/tap6krem              Rob Flicker
tap1208m                /report/fieldsinf/ap1208m/TEST/tap1208m         Sara Johan
tap1209m                /report/fieldsinf/ap1209m/TEST/tap1209m         Sara Johan
tap1209d                /u/fieldsinf/ap1209d/TEST/tap1209d              Rob Flicker

The output im looking for is a bit formatted one as follows

Code:
acttest         /report/fieldsinf/acttest/LIVE/acttest          Chris New
teatin1         /report/fieldsinf/eatin1/TEST/teatin1           Chris New
eatin1          /report/fieldsinf/eatin1/LIVE/eatin1            Chris New
tbectest        /report/fieldsinf/bectest/TEST/tbectest         Chris New
atptest         /report/fieldsinf/atptest/LIVE/atptest          Chris New
tap1201p        /report/fieldsinf/ap1201p/TEST/tap1201p         Tom Hanks
ap1201p         /report/fieldsinf/ap1201p/LIVE/ap1201p          Tom Hanks
tap6re2m        /report/fieldsinf/ap6re2m/TEST/tap6re2m         Sara Johan
tap1204m        /report/fieldsinf/ap1204m/TEST/tap1204m         Sara Johan
ap1204m         /report/fieldsinf/ap1204m/LIVE/ap1204m          Sara Johan
tap1205m        /report/fieldsinf/ap1205m/TEST/tap1205m         Sara Johan
taptestm        /report/fieldsinf/aptestm/TEST/taptestm         Sara Johan
aptestm         /report/fieldsinf/aptestm/LIVE/aptestm          Sara Johan
aptesty         /report/fieldsinf/aptesty/LIVE/aptesty          Sara Johan
tap6krep        /u/fieldsinf/ap6krep/TEST/tap6krep              Rob Flicker
tap6kidp        /report/fieldsinf/ap6kidp/TEST/tap6kidp         Rob Flicker
tap1207m        /u/fieldsinf/ap1207m/TEST/tap1207m              Rob Flicker
tap6krem        /u/fieldsinf/ap6krem/TEST/tap6krem              Rob Flicker
tap1208m        /report/fieldsinf/ap1208m/TEST/tap1208m         Sara Johan
tap1209m        /report/fieldsinf/ap1209m/TEST/tap1209m         Sara Johan
tap1209d        /u/fieldsinf/ap1209d/TEST/tap1209d              Rob Flicker

Any help would be greatly appreciated

Thanks in Advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatting a file

Hi All, I have been trying to format a file using sed. I can't seem to get the syntax right. I want to append the next line delemited by a comma or a comma and double quotes. Here is an example of the file I'm tring to format: Before formatting: 00324 03A0312 BRI-u24 0000324 01 H-12... (4 Replies)
Discussion started by: cstovall
4 Replies

2. Shell Programming and Scripting

Help with formatting of file.

I have a file with following file format - DMCRH|||83000171|||14022008||0430|||8956612.23|J|||3571235|1378452|23468|6894|9234| DMCRH|||83000215|||15092007||0480|||121.33|J|||LineID003|RefNumSP003|RefNumMem003|0004|0003| What i need done is - 1. Cut the firt four digits of the date (eg 1402... (3 Replies)
Discussion started by: divz
3 Replies

3. UNIX for Dummies Questions & Answers

Formatting a file.

I want to format a file to limit record length = 100, in each line. Any idea how i can do this? (1 Reply)
Discussion started by: abhilasha
1 Replies

4. Shell Programming and Scripting

File Formatting

Hi, Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it. Input ====================== l_s := ' INSERT INTO TEST' l_P PD := ' UPDATE INTO TEST' l_D := ' DELETE INTO TEST' This is test Input ======================... (1 Reply)
Discussion started by: saurabhbaisakhi
1 Replies

5. Shell Programming and Scripting

File Formatting

Hi, Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it. Input ====================== l_s := ' INSERT INTO TEST' l_P PD := ' UPDATE INTO TEST' l_D := ' DELETE INTO TEST' This is test Output ======================... (1 Reply)
Discussion started by: saurabhbaisakhi
1 Replies

6. Shell Programming and Scripting

File formatting

I need to count the number of lines between two sets of pattern in a file and delete those lines from that file e.g From jyotiv@yahoo.com test test2 test3 test4 test5 test6 From Jyotiv@yahoo.com So count lines from test to test6 and delete it from the start of file till next From... (1 Reply)
Discussion started by: jyotiv
1 Replies

7. Shell Programming and Scripting

File formatting

Hi, I have a file which contains data in this format # User@Host: abc @ Id: 0000000 # Query_time: 0.000070 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 SET timestamp=00000000; SELECT @@version, @@version_comment; # User@Host: abcd @ Id: 00000000 # Query_time: 0.000228 ... (6 Replies)
Discussion started by: arijitsaha
6 Replies

8. Shell Programming and Scripting

File Formatting

Hi, I have requirement to format the file.My input file tab(\t) saperated. File format is:- 93 WARNING Sat Mar 17 20:31:59 2012 Sequential_File_0,0: Missing record delimiter "\r\n", saw EOF instead 94 WARNING Sat Mar 17 20:31:59 2012 Sequential_File_0,0: Import... (4 Replies)
Discussion started by: prasson_ibm
4 Replies

9. Shell Programming and Scripting

Formatting file data to another file (control character related)

I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve. The source file is compose of many lines with such format: T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE ... (3 Replies)
Discussion started by: hk6279
3 Replies

10. UNIX for Dummies Questions & Answers

Formatting data in a raw file by using another mapping file

Hi All, i have a requirement where i need to format the input RAW file ( which is CSV) by using another mapping file(also CSV file). basically i am getting feed file with dynamic headers by using mapping file (in that target field is mapped with source filed) i have to convert the raw file into... (6 Replies)
Discussion started by: ravi4informatic
6 Replies
SENSIBLE-MDA(8) 					      System Manager's Manual						   SENSIBLE-MDA(8)

NAME
sensible-mda - a generic local MDA router for Debian systems SYNOPSIS
sensible-mda from to detail client-addr DESCRIPTION
sensible-mda is used to simplify the installation and configuration of sendmail(8) , or other MTAs for use on Debian systems. With sensi- ble-mda, sendmail can support a plethora of MDAs (procmail, maildrop, deliver, etc.) without having pick any one of them as required. FUNCTION
sensible-mda is called by sendmail as a local mailer when the following exists in sendmail.mc: define(`LOCAL_MAILER_ARGS', `sensible-mda $g $u $h ${client_addr}')dnl sensible-mda will look for the following MDAs (in this order), and pass the mail on to the first SUID MDA found (Or first found MDA, if run w/euid=root): procmail(1), maildrop(1), deliver(8), mail.local(8) OPTIONS
Available command line options are the following: from The sender of this email (sendmail $g variable) to The recipient of this email (sendmail $u variable) detail The detail portion of the recipient userid (sendmail $h variable) - ie: cowboy+sendmail@debian.org client-addr TCP/IP address of the sender (sendmail ${client_addr} variable) Not used (for the nonce) FILES
/etc/mail/sendmail.mc sendmail m4 input to generate sendmail.cf /etc/mail/sendmail.cf actual sendmail configuration file (treated as a binary file) SEE ALSO
sendmail(8), procmail(1), maildrop(1), deliver(8), mail.local(8) BUGS
None known so far. AUTHOR
Richard Nelson <cowboy@debian.org> HISTORY
4th Berkeley Distribution October 21 1999 SENSIBLE-MDA(8)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy