Sponsored Content
Top Forums UNIX for Dummies Questions & Answers LINUX to UNIX... changes needed? Post 302477982 by mschpers on Tuesday 7th of December 2010 12:25:04 AM
Old 12-07-2010
Quote:
Originally Posted by Franklin52
Please attach files in a flat format. Anyway, assuming the first instance of ";;;;" is on the first line:
Code:
awk 'NR==1{next}
!c || /;;;/{sub(";;;",""); c=sprintf("%04d",++i); close("comment" c ".txt")}
{print > "comment" c ".txt"}' monica.txt

Use nawk or /usr/xpg4/bin/awk on Solaris.
I hate to be a pain, but I'm still getting the return "awk: illegal statement at source line 3
context is
{print > "comment" >>> c <<< ".txt"}" when I run this code. Does anyone know how what is wrong with the third line?

---------- Post updated at 01:25 AM ---------- Previous update was at 01:22 AM ----------

Quote:
Originally Posted by Corona688
This "monica.txt" file isn't text, it's RTF! Hoping you knew that, but maybe you didn't. Substitution's still possible of course.

Boy, it's sure obnoxious having to work with BSD sed after having used GNU sed... Things any rational person would guess were basic, basic, basic features, like \n, don't work.

I did eventually manage to get it to do this:

Code:
$ echo "abc;;;def" | sed 's/;;;/\
/g'
abc
def
$

Yes, that is a literal newline inside the expression. You have to put a \ before the enter key to "escape" it or BSD sed will whine about it. It may be possible to substitute it in by putting the expression in double quotes, and using $'\n', but this may be more trouble than it's worth and involve outrageous numbers of backslashes.
]
Excuse my ignorance, but what do you mean by "newline inside the expression"? What would the full complete code be, exactly?
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux starter help needed

:confused: hi guys i'm helping out as a lab assistant and have been told to use a linux shell script to gather assignments from the students in the class I'm helping out in. They've been told to have their assignment in a certain folder in their accounts and I'm to gather them, only problem is I... (0 Replies)
Discussion started by: jaybee
0 Replies

2. Programming

Help needed linux socket programming in c

Good evening everyone! :) I'm doing a small client / server application for sharing files in C, and I am trying to implement the following: The client of my application sends to the address 255.255.255.255 a message requesting a particular file.In the network there is only one server,... (1 Reply)
Discussion started by: esmeco
1 Replies

3. UNIX for Dummies Questions & Answers

Linux Tutorial Needed

Hi guys , I m new to linux and would like to buy some quality video tutorials . Request you to guide me any good source for programming(C,Java,VB) or linux tutorials. Tutorials should be known and good like lynda.com (5 Replies)
Discussion started by: pinga123
5 Replies

4. Shell Programming and Scripting

Command needed in linux flavour OS

HI, My requirement as below Log with Error Code: Starting FeedRunner for feed: 200 Product example Items Error FeedRunner for feed: 200 Product example Items Stopping FeedRunner for feed : 200 Product example Items Feed time taken 231743 Log without Error Code: ... (0 Replies)
Discussion started by: Paulwintech
0 Replies

5. Homework & Coursework Questions

Linux/UNIX Bash Shell Script trouble help needed!!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 2. Shell Bash Script 3. !/bin/bash if echo no directory then mkdir -p /home/AC_Drywall elif ; then echo "$dir already exist" fi (4 Replies)
Discussion started by: TomFord1
4 Replies

6. Red Hat

Installing Linux on Vmware - Help needed

Hi Friends I am trying to install linux (32 bit) on windows. so i used Oracle virtual box and Vmware player in windows and installed them. but there is no category to select Linux version 7. how to install it pls help here. (7 Replies)
Discussion started by: ded325
7 Replies

7. Shell Programming and Scripting

Linux command needed

guys im new here and i need help with some linux commands. filea has keyword on each line identity aaa bbb ccc i have following commands. egrep 'www.identity' ~/home/m3 >~/home/lopo2 wc -l file ~/home/lopo2 say lopo2 has 44 lines then output saved is identity 44 (1 Reply)
Discussion started by: ahfze
1 Replies

8. UNIX for Beginners Questions & Answers

Linux router help needed

hi guys. I have an Kaon router wich runs "Linux version 3.10.24-svn1480 (jskim@jake-205) (gcc version 4.4.7 (Realtek MSDK-4.4.7 Build 1459". The problem I have it is that its firmware is in early stages and has alot of things messed up. Wake on lan doesn't work without arp binding and that can... (23 Replies)
Discussion started by: apoklyps3
23 Replies
All times are GMT -4. The time now is 03:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy