Sponsored Content
Top Forums Shell Programming and Scripting Create new file when three asterisks are encountered. Post 302699795 by elixir_sinari on Wednesday 12th of September 2012 10:12:59 AM
Old 09-12-2012
Another one:
Code:
awk '$0=="***"{f=++n".dat";print t > f;close(f);t="";b=0;next}{t=(!b?$0:t RS $0);if(!b) b=1}' file

And this will generate the files as you requested (1 file for the data before the 3 asterisk symbols in a line) and will not generate the fourth one as generated by some other solutions Smilie.

Last edited by elixir_sinari; 09-12-2012 at 11:21 AM..
This User Gave Thanks to elixir_sinari For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

554 Unallowed chars encountered

My Exchange v5.5 IMS server received an inbound internet-based message that it could not processed. The message header appeared to be corrupt and had a line that read, "Diagnostic-Code: smtp;554 Unallowed chars encountered." The message header also mentions UTF-7. All internet-based messages are... (1 Reply)
Discussion started by: abibbens
1 Replies

2. UNIX Benchmarks

Encountered error!

I used this on an AIX machine and encountered the following error. $ ls -l total 600 -rwxrwxrwx 1 e26936 dba 1491 Feb 07 1992 MANIFEST -rwxrwxrwx 1 e26936 dba 8148 Apr 05 1992 Makefile -rwxrwxrwx 1 e26936 dba 4852 Sep 06 2003 README -rwxrwxrwx... (0 Replies)
Discussion started by: puspendu
0 Replies

3. Shell Programming and Scripting

Double asterisks

When I go$ echo *I get a directory listing. When I go$ echo * *I get a directory listing, followed by a second identical directory listing. When I go$ echo **I only get one directory listing. What happens to the second asterisk in this case? Why doesn't it expand? I haven't been able to sleep... (2 Replies)
Discussion started by: na5m
2 Replies

4. Shell Programming and Scripting

Assistence With Using Asterisks in GREP Expressions

I am attempting to find all complete words which contain an asterisk at the beginning and the end - for instance, "*Hello?*" or "*you*". From what I've read, I would have thought that the following expression would do that just fine: \<\*.*\*\> \< denoting the beginning of a word. \*... (12 Replies)
Discussion started by: MagusScythe
12 Replies

5. Shell Programming and Scripting

need to replace asterisks

I need to replace occurrences of twelve asterisks "************" with the string " 0000000.00" . Note that there are two spaces in front of the first zero. How can I do this using awk or sed? (3 Replies)
Discussion started by: mustang_9333
3 Replies

6. Shell Programming and Scripting

build a string of asterisks elegantly

hi in a script i hate string definitions like str="***********************************" who can help to build a 50 character long string of asterisks more elegantly? any hint is welcome thanks and regards lazy (18 Replies)
Discussion started by: lazybaer
18 Replies

7. Shell Programming and Scripting

Eliminate or ignore asterisks in data when parsing

I have data file that has this in it: data.txt ......... ......... PPJ97**2017PPJ97**2017-03-21-13.35.15.887208********************START ERROR LOGGING****************** PPJ97**2017-03-21-13.35.15.887208** PROMPT APPLICATION ERROR ** PPJ97**2017-03-21-13.35.15.887208** IN TIMESTAMP |... (1 Reply)
Discussion started by: SkySmart
1 Replies

8. UNIX for Advanced & Expert Users

Show Asterisks when changing Password

Note: **Showing Asterisks when using SUDO is not what I am looking for. That method is well documented** Short Description: We have a requirement where users want to see that they are typing a password when logging into a RedHat box or when they are changing their password -- instead of... (1 Reply)
Discussion started by: caperjm
1 Replies

9. Shell Programming and Scripting

Replacing multiple asterisks in vi

i need to replace all occurrences of "period asterisk" as it is shown in this: blah blah .*:.*:.* blah blah with: :: so that the end result looks like this: blah blah :: blah blah I tried different variations of the following but it didint work: %s_ .*:.*:.* _ :: _g (2 Replies)
Discussion started by: SkySmart
2 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 01:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy