Search Results

Search: Posts Made By: Shell_Life
1,552
Posted By Shell_Life
We all know what must be done. The issue is...
We all know what must be done.

The issue is how to do it.

Please, provide your solution using actual unix commands.
1,552
Posted By Shell_Life
Here is one way of doing it: #!/bin/ksh sed...
Here is one way of doing it:
#!/bin/ksh
sed 's/.*\(__.*__.*\).xml/\1/' Inp_File | uniq | while read mStr; do
grep "${mStr}" Inp_File | sort -t_ -k3 -kn1 | tail -1
done
6,132
Posted By Shell_Life
See if this works for you: #!/bin/ksh ...
See if this works for you:
#!/bin/ksh
mMax=$(sort -t, -n -k3 b | tail -1 | sed 's/.*,//')
egrep ",${mMax}$" b
969
Posted By Shell_Life
See if the ^ (caret) works for you: /au/äu/ ...
See if the ^ (caret) works for you:
/au/äu/
/a[^u]/ä/
/o/ö/
/[^a]u/ü/
1,500
Posted By Shell_Life
Please, display the desired output.
Please, display the desired output.
3,034
Posted By Shell_Life
#!/bin/ksh ...
#!/bin/ksh
mX="https://abc.com/dir1/dir2/dir3/dir4/somefile.java"
echo ${mX} | sed 's#.*dir3/##'
1,137
Posted By Shell_Life
If the user selects a grouping field, would a...
If the user selects a grouping field, would a grep be sufficient?

Can you give us some examples of what the user could select?
885
Posted By Shell_Life
If every file has always two records that you do...
If every file has always two records that you do not want to count,
then multiply the number of files by two and then subtract this number from the total wc.

To find the number of files:
ls -1 |...
2,652
Posted By Shell_Life
Not true - you are not trying at all. I gave...
Not true - you are not trying at all.

I gave you a complete solution in this thread and you continue to ask for alternative solutions.

What do you really want to accomplish with so many...
3,299
Posted By Shell_Life
Can you provide a sample of the file?
Can you provide a sample of the file?
2,652
Posted By Shell_Life
If you had noticed, I made the two file names as...
If you had noticed, I made the two file names as variables for the shell.

This way, to have your desired output, you just run it twice:
1)

mF1='1.txt'
mF2='2.txt'

2)

mF1='2.txt'...
2,652
Posted By Shell_Life
You had a very similar post that I provided a...
You had a very similar post that I provided a solution using shell scripts:
https://www.unix.com/shell-programming-scripting/176428-grab-unique-record-different-files-condition.html

Change it...
10,602
Posted By Shell_Life
Here is a skeleton for one possible solution: ...
Here is a skeleton for one possible solution:
#!/bin/ksh
IFS='|'
while read mBefore mAfter; do
if [[ "${mBefore}" != "${mAfter}" ]]; then
echo ${mBefore} | sed 's/,/|/g' | read mB1 mB2 mB3...
1,678
Posted By Shell_Life
Here is a solution using shell scripts: ...
Here is a solution using shell scripts:
#!/bin/ksh
typeset -i mFromA mToA mFromB mToB
mF1='1.txt'
mF2='2.txt'
mPrevTag=''
#### sort is used to reduce the number of "grep"
sort ${mF1} | while...
1,737
Posted By Shell_Life
I used: GNU bash, version 3.2.0(1)-release...
I used:
GNU bash, version 3.2.0(1)-release (x86_64-unknown-linux-gnu)

As much as possible, if one solution can be given in a more universal usage, then we must provide it.

Otherwise, for the...
1,824
Posted By Shell_Life
You should have displayed the desired output. ...
You should have displayed the desired output.

Thus, making easier to understand your requirement.

In any event, an easy way to find if records of file A is present if file B:
grep -f FileB...
1,737
Posted By Shell_Life
Ran above code using bash and received the...
Ran above code using bash and received the following error:
grep: /dev/fd/62: No such file or directory

The following code works:
array1=(1234567 7665456 998889 000909)
array2=(1234567 5581445...
1,737
Posted By Shell_Life
Please show us what you have done so far. ...
Please show us what you have done so far.

You should have the logic and ask for help on which commands to use.
3,498
Posted By Shell_Life
See if this works for you: #!/usr/bin/ksh ...
See if this works for you:
#!/usr/bin/ksh
typeset -i mCnt
typeset -i mFlag
rm -f File.out
while read mLine; do
mCnt=$(echo ${mLine} | grep -c 'finally[ ]*{')
if [[ ${mCnt} != 0 ]]; then
...
1,448
Posted By Shell_Life
Based on the input, can you display the desired...
Based on the input, can you display the desired output?
1,716
Posted By Shell_Life
For your situation, you must use "&&"...
For your situation, you must use "&&" (and).
5,720
Posted By Shell_Life
See if this works for you: sed...
See if this works for you:
sed 's/\([A-Z0-9]\),/\1|/g' File
5,720
Posted By Shell_Life
Extracted from the 'sed' book:
Extracted from the 'sed' book:
1,459
Posted By Shell_Life
You can use: strings -n1 File
You can use:
strings -n1 File
1,828
Posted By Shell_Life
This is one way of doing it: sed...
This is one way of doing it:
sed 's/Search/Replace/' Input > Output
Showing results 1 to 25 of 500

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