My paragraphs are separated by blank lines. My apologies for not making that clear. I am sorry. The name of my file is "CodeSnippets", so should my code look like this?:
Code:
awk '/Flash/ {
for (i=1;i<=NF;i++) {
if ($i ~ /Flash/) {
if (i>1) {
printf $(i-1) OFS
}
print $i;
break
}
}
}' FS="\n" OFS="\n" RS="" ORS="\n\n" CodeSnippets
Suppose that CodeSnippets contained:
Code:
Some text, that could contain anything
Flash 1
Flash 2
Flash 3
2nd paragraph with key
word not seen until
the fourth line
Flash 4
Flash on line 1 and line 4
other text on subsequent lines
Do we get what we want
Flash again
after 2nd flash
Reason not to use input %s %d
as 1st arg to printf Flash
With this input, the code above produces something like:
Code:
Some text, that could contain anything
Flash 1
the fourth line
Flash 4
Flash on line 1 and line 4
awk: not enough args in printf(Reason not to use input %s %d
)
input record number 4, file CodeSnippets
source line number 5
Assuming that the output you want from the above sample input is:
Code:
Some text, that could contain anything
Flash 1
2nd paragraph with key
word not seen until
Flash on line 1 and line 4
other text on subsequent lines
Reason not to use input %s %d
as 1st arg to printf Flash
Hello again, I'm still working on the redo of my script I created before and came across a grep question.
I'm on SunOS 5.9 and using the Korn Shell. I'm writing a function to check for validation of root disks being mirrored. If the server allows me to use metastat, I'm looking to show it has... (4 Replies)
suppose i have a file structure(serial file)--
----------
----------
---------
summery
--------
------
--------
finished
-----
-------
i want to fetch lines from summery to finished
i can get line of summery by grep command. but how can i fetch lines untill it reaches finished.probably... (2 Replies)
Hi
I am writing a script which should read a file and search for certain strings 'approved' or 'removed' and retain only those lines that contain the above strings.
Ex: file name 'test'
test:
approved package
waiting for approval package
disapproved package
removed package
approved... (14 Replies)
Hi folks
I am not allowed to install GNU grep on AIX.
Here my code excerpt:
grep_fatal () {
/usr/sfw/bin/gegrep -B4 -A2 "FATAL|QUEUE|SIGHUP"
}
Howto the same on AIX based machine?
from manual GNU grep
‘--after-context=num’
Print num lines of trailing context after... (4 Replies)
I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like:
<ROW>
some information
more information
</ROW>
I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
gif2swf(1) swftools gif2swf(1)NAME
gif2swf - Takes a number of gif files and converts them to a swf movie, one picture per frame.
Synopsis
gif2swf [-X width] [-Y height] [-o file.swf] [-r rate] file1.gif [file2.gif ...]
DESCRIPTION
This tools converts gif image files into an SWF animation. It takes any number of input pictures, and converts them to SWF one-by-one,
where every converted picture is a separate frame in the target SWF.
OPTIONS -r, --rate framerate
Set movie framerate (frames per second)
-o, --output filename
Explicitly specify output file. (Otherwise, output will go to stdout / output.swf)
-z, --zlib zlib
Use Flash MX (SWF 6) Zlib encoding for the output. The resulting SWF will be
smaller, but not playable in Flash Plugins of Version 5 and below.
-l, --loop loop count
Set loop count. (default: 0 [=infinite loop])
-X, --pixel width
Force movie width to width (default: autodetect)
-Y, --pixel height
Force movie height to height (default: autodetect)
-v, --verbose level
Set verbose level (0=quiet, 1=default, 2=debug)
-C, --cgi
For use as CGI- prepend http header, write to stdout
-V, --version
Print version information and exit
gif2swf February 2012 gif2swf(1)