Search Results

Search: Posts Made By: pxalpine
2,320
Posted By pxalpine
Simple awk match for multiple lines
Is there a simple way to use awk to match multiple lines?? Somehow using \n isn't working for me. Ultimately I'm trying to insert "WWW" 3 lines above "eee".

input

aaa
bbb
ccc
ddd
eee...
1,295
Posted By pxalpine
Thanks Corona, it works! I'm seeing an...
Thanks Corona, it works!

I'm seeing an extra <key>$</key> at the end of every output line though, but I can just batch delete that, thanks!
1,295
Posted By pxalpine
Keyword search/replace for two text files?
What is the best way (bash/awk/sed?) to read in two text files and do a keyword search/replace?

file1.txt:

San Francisco
Los Angeles
Seattle
Dallas


file2.txt:

I love Los Angeles....
Forum: Programming 01-30-2013
1,391
Posted By pxalpine
Python: Check 2 text files for string and print contexts
I have 2 text files:

cities.txt
San Francisco
Los Angeles
Seattle
Dallas

master.txt
Atlanta is chill and laid-back.
I love Los Angeles.
Coming to Dallas was the right choice.
New York...
4,689
Posted By pxalpine
This works! I'm adding this into an earlier...
This works! I'm adding this into an earlier script that takes lines from a tsv. Does anyone know how to simplify this? Is tmp.txt even necessary?

sed -n 13,16p input.tsv > tmp.txt | tr '\t'...
4,689
Posted By pxalpine
Split each column in TSV file to be new line?
My TSV looks like:

Hello my name is John \t Hello world \t Have a good day! \t See you later!

Is there a simple bash script that splits the tsv on tab to:
Hello my name is John
Hello world...
4,752
Posted By pxalpine
Delete all words not containing letter /s/
I have a word file that looks like:

pens
binder
spiral
user


I want to delete all the words without the letter /s/, so output looks like:

pens
spiral
user


I tried using sed:
...
7,623
Posted By pxalpine
Sorry! I tried for i in *; do xmllint --format...
Sorry! I tried for i in *; do xmllint --format $i > pretty_$i; done and it works, kinda. thanks!
7,623
Posted By pxalpine
Thanks bipinajith, I tried what you provided and...
Thanks bipinajith, I tried what you provided and the script doesn't seem to end. I keep getting > for the next prompt.

---------- Post updated at 09:50 AM ---------- Previous update was at 09:48...
7,623
Posted By pxalpine
Xmllint pretty print, batch files
I have about 20 xml files I want to use xmllint to pretty print:

xmllint --format file01.xml > pretty_file01.xml
xmllint --format file02.xml > pretty_file02.xml
etc

Is there a way I can just...
2,218
Posted By pxalpine
What if you wanted to add a line at the beginning...
What if you wanted to add a line at the beginning and end of file?


call.xml
<head><body>
<value><tokens><token>Call</token><token>Mom</token></tokens></value>...
2,218
Posted By pxalpine
Read in 2-column CSV, output many files based on field
Is there a way to read in a two-columned CSV file, and based on the fields in 1st column, output many different files? The input/output looks something like:


input.csv:
call Call Mom....
2,151
Posted By pxalpine
Thank you pamu! One final question: when...
Thank you pamu! One final question: when comparing two files, how can i output lines in a.txt but not in b.txt? (while ignoring the lines common in both files)


file: a.txt
facebook
youtube...
2,151
Posted By pxalpine
sort -nrk1 file seems to sort the file from the...
sort -nrk1 file
seems to sort the file from the end.. makes it look like:


997690 últmos
997689 óm
997688 ódicos
997687 ívoro
997686 éxitosos
997685 éara
997684 èrsonal
997683 çilek
997682 áutobuses...
2,151
Posted By pxalpine
Thanks agama! Works like a charm! Do you...
Thanks agama! Works like a charm!

Do you know how to sort the output properly by the rank? I tried using "sort -k2 output.txt", but now it looks like:

output.txt
10002 the
10005 quick...
2,151
Posted By pxalpine
Compare two files, then outputs line number
I have two files, "ranked.txt" and "sorted.txt". Sorted.txt is a smaller subset from ranked.txt that is sorted in alpha order. However ranked.txt preserves the ranking of words I would like to keep....
Forum: Programming 02-10-2012
1,523
Posted By pxalpine
Minor editing of mass HTML files
Hello,

I'm manipulating a batch of about 2,000 HTML files. I just need to make some small changes, but to all the files at once.

For example, I want to delete the lines that have "embed_music"...
2,126
Posted By pxalpine
Thanks vgersh99, code worked perfectly. Is...
Thanks vgersh99, code worked perfectly. Is there a simple way to only perform the code on 4-digit numbers and ignore the 3-digit ones?

Output:
70 38 County Highway East, 107 Hidden Valley.
671...
2,126
Posted By pxalpine
Hi scottn, Thanks for the input, the sed...
Hi scottn,

Thanks for the input, the sed line worked. However is there a way to also break up the 4-digit numbers after the comma as well? So the output would look like:

70 38 County Highway...
2,126
Posted By pxalpine
Thanks, but what if the input.txt file also...
Thanks, but what if the input.txt file also includes words as well?

Input.txt:

7038 County Highway East, 1007 Hidden Valley.
6731 Street Del River, 5613 Stones Levee.
8995 Tuleburg Levee,...
2,126
Posted By pxalpine
Inserting space between numbers
Are there any one-liners or short codes to separate 4-digit numbers into 2?

For example, input.txt:
1234
5678
3091
2851

Output.txt:

12 34
56 78
30 91
28 51
3,020
Posted By pxalpine
Thanks agama. Just to learn, what does the /p at...
Thanks agama. Just to learn, what does the /p at the end of the code do?
3,020
Posted By pxalpine
kurumi's code worked, thank you. So I didn't try...
kurumi's code worked, thank you. So I didn't try daPeach's.

Is there a way to find lines that have more than 3 capitalized letters in them?
3,020
Posted By pxalpine
Help with regular expressions
I have a file that I'm trying to find all the cases of phone number extensions and deleting them. So input file looks like:

abc
x93825
def
13234
x52673
hello

output looks like:
abc
def...
2,555
Posted By pxalpine
Thank you! I used Franklin's cleanup code and...
Thank you! I used Franklin's cleanup code and then both of your codes worked! Many many thanks!
Showing results 1 to 25 of 35

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