Search Results

Search: Posts Made By: jl487
2,492
Posted By jl487
How to pass variables between scripts?
Hello, I have two bash scripts like the following:

script 1:
#!/bin/bash
var=WORLD
bash path/to/second/script/script2.bash



script 2:
#!/bin/bash
echo "HELLO $var"


I expected the...
771
Posted By jl487
*sigh* such a simple answer. Also the single...
*sigh* such a simple answer. Also the single quotes helped too. Thanks!
771
Posted By jl487
Need help with sed
So I have an input file that looks like this:



I want to use sed so that I can replace the string "$(variable)" but I can't seem to get it to work. I used the following one line to test, but no...
4,859
Posted By jl487
Thanks for the suggestion. Unfortunately, I have...
Thanks for the suggestion. Unfortunately, I have this in a bash script, so I'm trying to use bash.
4,859
Posted By jl487
How to set character limit on READ?
Hello,
I created the following (snippet from larger code):


echo -n "A1: "
read A1

VERIFY=$(echo -n $A1|wc -c)
if [ $VERIFY -gt 8 ]; then
echo -e "TOO MANY CHARACTERS"
fi

echo...
1,245
Posted By jl487
i think i may have found a flaw in this code. It...
i think i may have found a flaw in this code. It seems as though if there is a space in any of the lines, it's ignored/thrown out, even if it's unique.

Can someone please help me?
1,245
Posted By jl487
it works! Thanks!
it works! Thanks!
1,245
Posted By jl487
Find unique lines based off of bytes
Hello All,
I have two VERY large .csv files that I want to compare values based on substrings. If the lines are unique, then print the line.

For example, if I run a

diff file1.csv and...
2,273
Posted By jl487
basically, if I could get a list of all...
basically, if I could get a list of all duplicated ages and another list of all unique values, that would work. Then I could just concatenate them back together. For the duplicated age, descending...
2,273
Posted By jl487
Sort csv file by duplicated column value
hello, I have a large file (about 1gb) that is in a file similar to the following:



I want to make it so that I can put all the duplicates where column 3 (delimited by the commas) are shown on...
1,131
Posted By jl487
Hoping I understand your problem... I think...
Hoping I understand your problem...

I think you should use either a while loop to awk to figure this out since you would have to go line by line. For example, the script would look at line one....
3,266
Posted By jl487
way better than mine!
way better than mine!
3,266
Posted By jl487
thanks itkamaraj. I found a different variation...
thanks itkamaraj. I found a different variation to solve my problems. I used to isolate block one from the other blocks.

sed -n '/topLevel numberBlock="BLOCK1"*/,/<\/topLevel>/p' inputfile.xml
3,266
Posted By jl487
How to grab data from xml block?
I tried searching the forums, but couldn't find anything relevant to my question.

I have an xml file like the following:

<topLevel numberBlock="BLOCK1">
<item="content1" title="Content 1">...
2,914
Posted By jl487
i understand that the script works for "REJECT"...
i understand that the script works for "REJECT" but how can this be modified to accept wildcards. For example, if input is:


titleA
titleB
TEST FILLER
titleC
TEST


and REJECT=TEST, I...
2,914
Posted By jl487
ok, I think i'm starting to understand it. I just...
ok, I think i'm starting to understand it. I just assumed the code could be universal where I could simply swap the strings.
2,914
Posted By jl487
I created a new input, to test the code: ...
I created a new input, to test the code:

titleA
titleB
TEST
titleC
TEST


and used the following:

# Recall N lines ago up to 9 lines
function last(N)
{
if(N>L) return("");
...
2,914
Posted By jl487
Thanks corona. If I want to substitute "titlex"...
Thanks corona. If I want to substitute "titlex" with another string, how can I do that? In the code, I replaced "title[^xX]" with another string to test, but it outputs the new searched string.
2,914
Posted By jl487
I don't want to have titleB and titleD in my...
I don't want to have titleB and titleD in my output. With "grep -v" I would get titleA, titleB, titleC, titleD, and titleE.

I found the following, which would produced an output of just titleB...
2,914
Posted By jl487
Possible to grep string based on surrounding strings?
I was wondering if it was possible to grep a pattern based on the surround text. For example, if i have an input file like this:


titleA
titleB
titlex
titleC
titleD
titlex
titleE


And I...
5,256
Posted By jl487
Nice :b:!! The naming convention modifcation will...
Nice :b:!! The naming convention modifcation will definitely help when sorting/merging.

Now I just need to merge files based on size.
5,256
Posted By jl487
Split a file based on pattern and size
Hello, I have a large file (2GB) that I would like to split based on pattern and size.

I've used the following command to split the file (token is "HELLO")

awk '/HELLO/{i++}{print > "file"i}'...
2,588
Posted By jl487
thanks. I have a text file with a bunch of...
thanks. I have a text file with a bunch of Results('xxx', 'yyy', ), so i was hoping i didn't have to use the command echo.
2,588
Posted By jl487
Need help with Sed (replacing parenthesis and comma)
I have the following text as an input text:

input.txt

Results('Toilet', 'Sink', )


and i want to remove the last comma so the output is

output.txt

Results('Toilet', 'Sink' )

...
1,156
Posted By jl487
Format Parts of Multiline Section to Single Line
Hello, I have an input file that I need formatted. I was hoping I could use bash to get this done.


Title: Kitchen
Blender
Washer
Dishes

Title: Bathroom
Toilet
Sink

Title: Bedroom...
Showing results 1 to 25 of 94

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