Search Results

Search: Posts Made By: apalex
1,638
Posted By apalex
Thanks! In another example below, how about...
Thanks!

In another example below, how about substituting string3 ONLY to the first occurrence of string2, right after the occurrence of string1? The pattern I am looking for is string1 and just...
1,638
Posted By apalex
sed - substitute first occurrence after search
I found this in the forum that searches a file for string1, substitute all occurrences of string2 with string3.
(Title: Replace string2 by string3 where string1 is found in line)

>> sed -i...
2,363
Posted By apalex
I was able to use the solution provided by RudiC...
I was able to use the solution provided by RudiC for the required file output (yes, also after removing the BOM from source file).
I'm currently using the solution provided by ctsgnb on other...
2,363
Posted By apalex
Generate files and use csv data to replace multiple variables in a template
I have a source csv file consists of first field as variable name, and the rest are site-specific information (converted from excel file, where site -specific values in columns). I am trying to...
5,428
Posted By apalex
Thanks, it works! sed 's/\.[^.]*$//' infile
Thanks, it works!

sed 's/\.[^.]*$//' infile
5,428
Posted By apalex
cut and print part of a string
I have a file that contains:

yahoo.com.23456
web.log.common.us.gov.8675
192.168.1.55.34443
john-doe.about.com.22233
64.222.3.4.120
sunny.ca.4442

how can i remove the strings after the last...
6,515
Posted By apalex
filter parts of a big file using awk or sed script
I need an assistance in file generation using awk, sed or anything...

I have a big file that i need to filter desired parts only. The objective is to select (and print) the report # having the...
12,574
Posted By apalex
awk variable substitution
for the command below, it looks for the 3rd field value matching "P" and printing it.

awk '{if ($3 == "P") print}' file

how would i express this if i use a loop to find more that 1 variable fro...
25,393
Posted By apalex
can this be done using the same command above? ...
can this be done using the same command above?

thanks.
apalex
25,393
Posted By apalex
you are right sorry about that. how to awk,...
you are right sorry about that.

how to awk, to print the lines with integers only, having random patterns.

from:

qwerty
12345
asdfg
56789
zxcvb
00001
58364
22222


will be:
...
25,393
Posted By apalex
awk or grep for integer only
how do you print the lines that contain integers only, using grep or awk?

thanks ,
apalex

------------------
this file below:
qwerty
01234
asdfgh
01234
qwer12
asdf05

will be:
01234...
7,385
Posted By apalex
Extract data segment using awk??
How do I filter a long report, with the "STARTWORD" and "STOPWORD" as the variables to use in my awk command, to print the whole data segment that only contains the matched start/stop word?

awk...
4,316
Posted By apalex
the shell script worked fine, thank for this...
the shell script worked fine, thank for this helpful info i can use at work. just a clarification though, what does << End_of input do? on the first line?

thanks...
4,903
Posted By apalex
sed search and insert
how can i modify a file using sed when searching
for a pattern and insert newline after the pattern?

pattern example: $ ...(any characters)...$

$ may082001.../tmp/msg.001,,$ REPT CLEAR...
21,705
Posted By apalex
Thanks for the info!
Thanks for the info!
21,705
Posted By apalex
Perderabo, can you please explain further the...
Perderabo, can you please explain further the line below?
i can't follow the logic of using ", ' ,= and {} on the sed.

sed -n '/'"${string}"'/=' < infile

Is there any fix in the code for...
21,705
Posted By apalex
Thanks Perderabo! i tried your code and it...
Thanks Perderabo!

i tried your code and it works great. although i had an error
when i entered the string df/DF.

apalex>cat infile
pattern1 $Major
pattern2 -Crit
pattern3 df/DF
...
21,705
Posted By apalex
awk/sed with special characters
i have this script that searches for a pattern.
However it fails if the pattern includes some
special characters. So far, it fails with the
following strings:
1. -Cr
2. $Mj
3. H'412...
6,548
Posted By apalex
worked great!! thanks!
worked great!! thanks!
6,548
Posted By apalex
loop alternative?
I have a 1-column file with
random numbers. this script runs
to subtract 1 to the number and
written to a file. With over
10,000 lines, it takes >2 minutes
to complete the loop operation.

is...
3,474
Posted By apalex
i have this on my printline script. i'm just...
i have this on my printline script. i'm just wondering if there's a better way...

# printline 344

b=`expr $1 - 1`
a=`expr $1 + 1`
sed -n ''$b','$a'p' file > newfile
3,474
Posted By apalex
print adjacent lines
how do you print the lines before and after the line you are interested in? Example: Line to be printed: line 344

Output:
line 343
line 344
line 345

Thanks
3,657
Posted By apalex
you are missing a slash (/) after 2002 in your...
you are missing a slash (/) after 2002 in your original command.

sed "s/ACTIVE/2002/" myfile.txt > yourfile.txt

this replaces the first occurrence of text ACTIVE with 2002 in each line.

g...
3,657
Posted By apalex
try: sed '/ACTIVE/s//2002/' mydata.txt >...
try:

sed '/ACTIVE/s//2002/' mydata.txt > yourdata.txt
13,384
Posted By apalex
extract data from file
My file in ksh consists of message data of varying lengths (lines), separated with headers.
I would like to find a string from this file, and print out the whole message data including the...
Showing results 1 to 25 of 45

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