Sponsored Content
Top Forums Shell Programming and Scripting Create new file when three asterisks are encountered. Post 302699751 by RudiC on Wednesday 12th of September 2012 08:39:05 AM
Old 09-12-2012
Code:
awk     'BEGIN{fname=++nr".txt"}
         {print $0 > fname}
         /\*\*\*/{fname=++nr".txt"}
        ' file.txt

This User Gave Thanks to RudiC 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
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)
All times are GMT -4. The time now is 05:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy