05-17-2009
A simple solution:
cat file
Here and now
cat file | sed 's/ /\n/g' | grep "and" > output_file.text
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Ok, I'm stumped and can't seem to find relevant info.
(I'm not even sure, I might have asked something similar before.):
I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
Discussion started by: ropers
2 Replies
2. Shell Programming and Scripting
Hi!
I want to made a program that will generate code like this:
{{Navedi XYZ
|avtor=XYZ1
|naslov=XYZ2
|leto_izzida=XYZ3
|zalozba=XYZ4
|kraj=XYZ5
|isbn=XYZ6
|cobiss_id=XYZ7
}}
from input like this:
<b> ODGOVORNOST............. : <a... (5 Replies)
Discussion started by: smihael
5 Replies
3. Shell Programming and Scripting
Hi guys
I need to find both negative and positive numbers from the following text file. And i also dont need 0.
0
8
-7
-2268
007
-07
-00
-0a0
0a0
-07a0
7a00
0a0
Can someone please give a regex to filter out the values in red. I tried a few things in awk but it didnt work... (9 Replies)
Discussion started by: sridanu
9 Replies
4. Shell Programming and Scripting
Hello,
Could someone explain why this one returns nothing:
$ x=/jon/
$ echo jon | awk -v xa=$x '$1~xa {print}'
$
while the following works fine:
$ x=jon
$ echo jon | awk -v xa=$x '$1==xa {print}'
$ jon
and the following works fine:
$ echo jon | awk '$1~/jon/ {print}'
$ jon
... (3 Replies)
Discussion started by: vilius
3 Replies
5. Shell Programming and Scripting
hi everyone
suppose my input file is
ABC-12345
ABCD-12345
BCD-123456
i want to search the specific pattern which looks like
-
in a file so i used this command
cat $file | awk ' { if ($0 ~ /-/) { print } }'
so it gives me the result as
ABCD-12345
BCD-12345
BCD-12345
... (31 Replies)
Discussion started by: aishsimplesweet
31 Replies
6. UNIX for Dummies Questions & Answers
Hi can you suggest in this regard
The sample.txt conatins the data
name lines type
sam 12 txt
sam 24 xls
sam 36 pdf
ram 32 txt
ram 45 sxls
ram 58 word
sam 92 jpeg
sam 21 gif
sam 22 ltf
from the data i need to sum all line... (5 Replies)
Discussion started by: krashraj
5 Replies
7. Shell Programming and Scripting
Hi all,
Can someone tell me what's the (g)awk equal of this simple regex to find ip addresses in urls:
egrep "^http://{1,3}\.{1,3}\.{1,3}\.{1,3}(:{1,5})?/"Input:
http://10.0.0.1/query.exe
http://11y10x09w:80/howaboutme
http://192.168.100.190:1234/takeme.gpg
Output:... (8 Replies)
Discussion started by: r4v3n
8 Replies
8. Shell Programming and Scripting
Hello I have a file like :
20120918000001413 | 1.17.163.89 | iSelfcare | MSISDN | N
20120918000001806 | 1.33.27.100 | iSelfcare | 5564 | N
....
I want to extract all lines that have on 4th field (considering "|" the separator ) something other than just digits. I want to do this using a... (5 Replies)
Discussion started by: black_fender
5 Replies
9. Shell Programming and Scripting
Hello to all,
I have:
X="string 1-"
Y="-string 2"
Z="string 1-20-string 2"In the position of the number 20 could be different numbers, but I'm interest only when the number is 15, 20,45 or 70.
I want to include an IF within an awk code with a regex in the following way.
... (12 Replies)
Discussion started by: Ophiuchus
12 Replies
10. Shell Programming and Scripting
I have location as
line=/got/cpp/track/tmp/piy/p_tok.xml
I need the path till tmp i.e. /got/cpp/track/tmp
i tried test=${line%/)}
and i am getting location till /got/cpp/track/tmp/piy
Can anyone help me in correcting my regex (2 Replies)
Discussion started by: dreams619
2 Replies
LEARN ABOUT DEBIAN
plan9-split
SPLIT(1) General Commands Manual SPLIT(1)
NAME
split - split a file into pieces
SYNOPSIS
split [ option ... ] [ file ]
DESCRIPTION
Split reads file (standard input by default) and writes it in pieces of 1000 lines per output file. The names of the output files are xaa,
xab, and so on to xzz. The options are
-n n Split into n-line pieces.
-l n Synonym for -n n, a nod to Unix's syntax.
-e expression
File divisions occur at each line that matches a regular expression; see regexp(7). Multiple -e options may appear. If a subex-
pression of expression is contained in parentheses (...), the output file name is the portion of the line which matches the subex-
pression.
-f stem
Use stem instead of x in output file names.
-s suffix
Append suffix to names identified under -e.
-x Exclude the matched input line from the output file.
-i Ignore case in option -e; force output file names (excluding the suffix) to lower case.
SOURCE
/src/cmd/split.c
SEE ALSO
sed(1), awk(1), grep(1), regexp(7)
SPLIT(1)