Requirement of Spliting a text file in UNIX Programing


View Poll Results: What's the kernel for linux
A 2 100.00%
B 0 0%
Voters: 2. This poll is closed

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Requirement of Spliting a text file in UNIX Programing
# 1  
Old 03-04-2014
Requirement of Spliting a text file in UNIX Programing

Hi,

There is a requirement, needs to split the text file based on RC code present in text file.
For this, needs to write a unix shell programing script for the above requirement.

For example in text file, if there are distinct RC codes, then we needs to split into multiple text files. In this text file RC codes(9102 and 9103) are to be split in to 2 separate files.

Please find attached is the text file.

Could you please help me to get complete program logic for this requirement.

If you need more info please let me know.
# 2  
Old 03-04-2014
Try this:
Code:
awk -F'[= ]' '/^ RC=/{rc=$3}rc{print>>rc".txt"}' file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX requirement

Hi Everyone, Can anyone of you help me on how to get files creation time on ftp server/Remote server in unix. Regards, Avinash. (6 Replies)
Discussion started by: Avinash varma
6 Replies

2. Shell Programming and Scripting

UNIX - requirement

Hi All, I have a source file with data Name ~ Groups Muni~abc,was,USA_ax,123 Chaitanya~USA_12,was Balaji~123,xyz,was Ramu~123,xyz From the second column i want to extract only the groups that matches the pattern 'USA_%' or if the group = 'was', and ignore any other columns. ... (8 Replies)
Discussion started by: morbid_angel
8 Replies

3. IP Networking

Help with Unix socket programing

hi I am strucked in a client server program client need to login to server client logins if only username and password are correct i have written a program username is stored as file and password is smilar to username whic is stored in that file when server asks for username... (2 Replies)
Discussion started by: karthik1238
2 Replies

4. Shell Programming and Scripting

mailx requirement - email body header in bold and data content in normal text

Dear all- I have a requirement to send an email via email with body content which looks something below- Email body contents -------------------- RequestType: Update DateAcctOpened: 1/5/2010 Note that header information and data content should be normal text.. Please advice on... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

5. Shell Programming and Scripting

spliting up a large file

Dear All, I have a very large file which which i would like split into indvidual frames evrytime the line ends with "ENDMDL" and then name frame1.pdb frame2.pdb etc can any one give me a few sugeestions? ideally i would like to have ENDMDL at the end of each frame or not pressent at all. an... (4 Replies)
Discussion started by: Mish_99
4 Replies

6. Shell Programming and Scripting

File Spliting problem

I have a very big log file which looks like this: I need to split this file and create files with "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" as the delimiter. The file names need to be the contents of the next line after the delimiter(FIRST_ITEM,SECOND_ITEM...so on..). (7 Replies)
Discussion started by: engineer
7 Replies

7. UNIX for Dummies Questions & Answers

spliting a file

how would i split the file "file1" into smaller files containg lines of 15 (1 Reply)
Discussion started by: JamieMurry
1 Replies

8. Programming

creating GUI using C programing in unix server

I want to write GUI using C programing in Unix server. But I can not use windows.h header file. I want to create some text box using C programing. Please suggest me any sample code or tutorial for this purpose. I do not know any thing about GUI programing in C language. Thanks in... (5 Replies)
Discussion started by: rinku
5 Replies

9. UNIX for Dummies Questions & Answers

spliting up a huge file

I have a file {filename} which contains 65000 records I need to split into 6 smaller files roughly 11000 records each. Can someone advise me of the Unix command to do so ? Many thanks (2 Replies)
Discussion started by: grinder182533
2 Replies

10. UNIX for Dummies Questions & Answers

system requirement for unix

I want to try running the free down load from sun, their solaris 8. I have an intel pentium 3, 550 mhz, 8 GB drive, with 128 ram. I this anough to run a unix os like solaris 8. Also is their a browser that I could use with solaris8 so as to connect to the internet. Does ie have a version for unix.... (3 Replies)
Discussion started by: gparsons70
3 Replies
Login or Register to Ask a Question