Search Results

Search: Posts Made By: Novice-
3,455
Posted By Scrutinizer
Nice...
Nice...
3,104
Posted By ygemici
# sed -n -e :x -e '/PATTERN.*/{;N;N;p;d;}' -e tx...
# sed -n -e :x -e '/PATTERN.*/{;N;N;p;d;}' -e tx infile
PATTERN1
ppppapapappappapa
qmqkkqhqgqgqgqg
PATTERN2
FFFFD KKKKJ
MMMMMQQQQQQM
PATTERN3
MMMDDD
DDDDDDD
PATTERN4
RRRRRRRRR
FFFFF...
3,104
Posted By ygemici
this will be output file ok :b: at now can you...
this will be output file ok :b:
at now can you write a little portion for your input file ?
3,104
Posted By Christoph Spohr
Hi, do you mean something like this: ...
Hi,

do you mean something like this:

sed -n '/^\(pattern1\|pattern2\|pattern3\|pattern4\)/{N;N;p}' file

HTH Chris
3,104
Posted By ygemici
what is your desired output?
what is your desired output?
3,455
Posted By drl
Hi. Similar to that of Scrutinizer, but more...
Hi.

Similar to that of Scrutinizer, but more explicit, and slightly less efficient (more division operations involving NR), but still a single pass over the data:
#!/usr/bin/env bash

# @(#)...
3,455
Posted By alister
sed -n 'p;n;h;n;p;g;p'
sed -n 'p;n;h;n;p;g;p'
3,455
Posted By Scrutinizer
Is this what you mean: awk '(NR%3)==2{p=$0;...
Is this what you mean:
awk '(NR%3)==2{p=$0; getline; $0=$0 RS p}1' infile
output:
aaaaaaaaaa
cccccccc
bbbbbbbbb
aaaaaaaaaa
cccccccc
bbbbbbbbb
3,455
Posted By pseudocoder
I'd first split the file after every 3 lines,...
I'd first split the file after every 3 lines, like so:
split -l3 file
In this case 2 files are produced: xaa xab

for i in x*; do
awk 'NR == 1 { l1=$0 }
NR == 2 { l2=$0 }
NR == 3 {...
1,517
Posted By pseudocoder
while read line; do echo "$line" | grep "^$"...
while read line; do
echo "$line" | grep "^$" >/dev/null 2>&1 && (echo; echo) || echo -n $line
done <file ; echo
<span class="time"><strong>06:00</strong></span>

<div class="cDesc"...
1,730
Posted By bartus11
awk -vRS= '{gsub("\n","");print}'...
awk -vRS= '{gsub("\n","");print}' file
15,806
Posted By frans
It's bash scripting so on the first line of the...
It's bash scripting so on the first line of the script you write #!/bin/bash If the path of your shell is /bin/bash, of course.
The full code :
#!/bin/bash
while read LINE
do
echo $LINE |...
15,806
Posted By frans
using grep
try this
I=0
while read LINE
do
TEXT[$I]=$(echo $LINE | grep -o '<text>.*</text>' | sed -e 's/<text>//' -e 's/<\/text>//'
(( I ++ ))
done < $FILENAMEThat creates an array where each...
Showing results 1 to 13 of 13

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