Search Results

Search: Posts Made By: KidCactus
1,619
Posted By elixir_sinari
If you don't mind some extra new-lines: sed...
If you don't mind some extra new-lines:
sed 's/^test@server/\
&/' file|sed "/(id=$id)/,/^$/!d"
8,243
Posted By Scott
grep string file* would work (assuming "file*"...
grep string file* would work (assuming "file*" doesn't expand to too many files).

If you want to do this from the command line, then:

$ ./myScript "some string to search for" file*

$ cat...
1,135
Posted By vgersh99
use double-quotes instead of the single-quotes -...
use double-quotes instead of the single-quotes - you need to have your script parameter evaluated.
9,183
Posted By radoulov
Adjust the months names :) perl -ne'BEGIN { ...
Adjust the months names :)

perl -ne'BEGIN {
@m{
qw[ jan feb mar apr maj jun jul aug sep oct nov dec ]
} = 1 .. 12;
}
/^(\d+) (\w+) (\d+) (\d+):(\d+)/ and
$d = join "", sprintf...
1,786
Posted By zaxxon
Is this homework/classroom stuff? What have you...
Is this homework/classroom stuff? What have you tried so far?...

I got no idea for sed; nevertheless:

> cat infile
aa bb cc dd ee
$> awk '{a=substr($0,0,n); b=substr($0,n+1); gsub(/ /,"",a);...
9,183
Posted By radoulov
perl -ne'BEGIN { @m{ qw[ jan feb mar...
perl -ne'BEGIN {
@m{
qw[ jan feb mar apr may jun jul aug sep oct nov dec ]
} = 0 .. 11;
}
do {
@d = split/[\s:]/;
$d = join "", $d[2], $m{$d[1]}, $d[0], $d[3], $d[4];
...
922
Posted By birei
Hi, Something similar to this?? $ perl...
Hi,

Something similar to this??
$ perl -pe 'chomp if s/img_onload.{8}//g' infile

Regards,
Birei
3,370
Posted By Klashxx
A little dirty but: perl -pne 's/\n//g'...
A little dirty but:
perl -pne 's/\n//g' html>html2
Then:
perl -ne 'while(/<a[^>]*thread_id[^>]*>([^>]*)<\/a>[^<]*<br>[^>]*<div style[^>]*>([^>]*)<\/div>/g){print $1."\n\n".$2."\n\n";}' html2
3,370
Posted By Klashxx
Use: perl -ne ...
Use:
perl -ne 'if(/thread_id[^>]*>([^>]*)<\/a.*div style[^>]*>([^>]*)<\/div>/){print $1."\n\n".$2."\n\n";}' htmlFile
6,455
Posted By Scrutinizer
Small correction to panyam's suggestion: ...
Small correction to panyam's suggestion:
awk-statement "$file_name" > "${file_name%.*}_2.php"
6,455
Posted By panyam
for file_name in *.php do ---your awk...
for file_name in *.php
do
---your awk statement $file_name > ${file_name}"_2".php
done
6,455
Posted By Scrutinizer
awk 'NF{if(n>1)print x;n=0;print;next}{n++}'...
awk 'NF{if(n>1)print x;n=0;print;next}{n++}' infile
Showing results 1 to 12 of 12

 
All times are GMT -4. The time now is 11:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy