pattern changing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pattern changing
# 1  
Old 01-14-2009
pattern changing

Hi,

I have a file with contents in this format....

0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0...

How can I make it to this format...

0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
.
.
.


Is there any command that can help me acheive this quickly..

I have just quoted like '0123456789'.. I just put it up like that... Its not in a seriel fashion... But the length of each record after formatting should is fixed say 30....


Thanks for all your help!

Last edited by kripssmart; 01-14-2009 at 12:29 PM..
# 2  
Old 01-14-2009
I have just quoted like '0123456789'.. I just put it up like that... Its not in a seriel fashion... But the length of each record is fixed say 30....

Thanks!
# 3  
Old 01-14-2009
Take a look at the fold command:

Code:
fold -w 30 file

[if I correctly understood your requirement]
# 4  
Old 01-16-2009
Yep PERFECT!!!
Thanks Rubin...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

2. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

3. Shell Programming and Scripting

Searching the pattern and accordingly changing the contents using shell

HI, I have File1 which contains :- admins = anand,satheesha,user1,user2,user3,user4,user5,user10,vishal nonadmins = read-only @admins = rw @nonadmins = r One shell script, using that I want to change the File1 as per user input (let's say $1) which have value as 'John', so now I want to... (6 Replies)
Discussion started by: Vishal Mishra
6 Replies

4. UNIX for Dummies Questions & Answers

Match Pattern after certain pattern and Print words next to Pattern

Hi experts , im new to Unix,AWK ,and im just not able to get this right. I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies

5. Shell Programming and Scripting

File pattern changing

Hello All, I have a file say cat test.txt sathya sxk opt Sandy sxr omg Ram rxm opt Now I would like to change opt to omr only for the line in my file sathya sxk opt How can i do it. I know we can do it with sed -i option, but its not present in my system, please help me some... (13 Replies)
Discussion started by: sathyaonnuix
13 Replies

6. Shell Programming and Scripting

Changing the first occurrence after matching a pattern

Hi, I got a file which looks like this: Value A Status: - Other: - Value B Status: - Other: - Value C Status: - Other: - I would like to change only the first line which includes the "Status:" string after matching the line containing "Value B", so the output file should look... (5 Replies)
Discussion started by: wenclu
5 Replies

7. Shell Programming and Scripting

Insert new pattern in newline after the nth occurrence of a line pattern - Bash in Ubuntu 12.04

Hi, I am getting crazy after days on looking at it: Bash in Ubuntu 12.04.1 I want to do this: pattern="system /path1/file1 file1" new_pattern=" data /path2/file2 file2" file to edit: data.db - I need to search in the file data.db for the nth occurrence of pattern - pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies

8. Shell Programming and Scripting

search a pattern and if pattern found insert new pattern at the begining

I am trying to do some thing like this .. In a file , if pattern found insert new pattern at the begining of the line containing the pattern. example: in a file I have this. gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies

9. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies

10. Shell Programming and Scripting

Changing Pattern in a file

I have a config file with the pattern given below. /usr/games cocoa fudge # export to only these machines /usr -access=clients # export to my clients /usr/local # export to the world /usr2 -access=bison:deer:pup ... (0 Replies)
Discussion started by: pbtenneti
0 Replies
Login or Register to Ask a Question