Search Results

Search: Posts Made By: mmab
2,328
Posted By mmab
Sort alphabetically starting from specified letter
Hi.

I'm trying to sort a list of items in a file alphabetically but starting from the letter 'X'. For instance if I had the following file;

test.txt


Z
A
T
W
Y
B
S
X
I would like...
2,560
Posted By mmab
That works! thanks to those who responded. ...
That works! thanks to those who responded.

---------- Post updated at 11:46 AM ---------- Previous update was at 11:25 AM ----------

One last thing. In the input file there is the possibility...
2,560
Posted By mmab
Here is a cleaned up version of the input file...
Here is a cleaned up version of the input file showing how each field can have an undefined amount of data;


"NEW PRODUCT, VERSION 1.1"
PRODUCT_01
"PRODUCT FIELD"
FIELD_X
11.11
11.22
11.33...
2,560
Posted By mmab
Thanks for your response! I ran your code on the...
Thanks for your response! I ran your code on the file and got the following output;
"NEW PRODUCT, VERSION 1.1"
PRODUCT_01
FIELD_X FIELD_Y
11.11 22.22

"NEW PRODUCT, VERSION 1.1"
PRODUCT_02...
2,560
Posted By mmab
Split 1 column into numerous columns based on patterns
Hi,

I have a text file 'Item_List.txt' containing only 1 column. This column lists different products, each separated by the same generic string header "NEW PRODUCT, VERSION 1.1". After this the...
6,316
Posted By mmab
Wasn't complaining, just new to this and trying...
Wasn't complaining, just new to this and trying different things.
Appreciate your help
6,316
Posted By mmab
Thanks for the quick reply. When I run...
Thanks for the quick reply.

When I run this on a txt file with no duplicates it works great. But when I run it on a file with duplicates I get the following output;


awk 'BEGIN { FS =...
6,316
Posted By mmab
awk If expression - Return string if not true
Hi,

I have the following txt file List_With_Duplicates.txt;

a,1,1
b,3,4
c,5,2
d,6,1
e,3,3
f,3,7

When I run the command
awk -F ',' '{if($2==$3){print $1","$2","$3}}'...
11,864
Posted By mmab
Thanks, I tried it exactly like you wrote it; ...
Thanks, I tried it exactly like you wrote it;

Code;
printf "%s %s %*s %s\n" 'random' 'random' $m ' ' 'random'

but when I run the .sh script it just keeps running without displaying anything.
11,864
Posted By mmab
Again, i've confussed things, sorry. The padding...
Again, i've confussed things, sorry. The padding of the 2nd column is based on a defined scalar variable, like so;

Code;
m=6
printf "%s %-${m}g %s\n" 'text' 'martin' 'text'
printf "%s %-${m}g...
11,864
Posted By mmab
I typed the code as you wrote it, however when...
I typed the code as you wrote it, however when run it doesn't output anything. I would also prefer not to state an actual number in the code, rather just use the scalar variable.

Thanks
11,864
Posted By mmab
Sorry, I made a mistake in my code. The print...
Sorry, I made a mistake in my code. The print line was meant to read like so;

printf "%0s %-$m %0s\n" 'random text' 'random text' 'random text'

This would produce the following output;
...
11,864
Posted By mmab
I would like to make an addition to the above. I...
I would like to make an addition to the above. I have the following;

#!/bin/sh

theUse[0]=john
theUse[1]=james
theUse[2]=ian
theUse[3]=martin
m=-1
for x in ${theUse[@]}
do
if...
1,775
Posted By mmab
Ah, see what you mean. It would only store the...
Ah, see what you mean. It would only store the last item selected rather than all of them. Thanks.

---------- Post updated at 11:25 AM ---------- Previous update was at 11:12 AM ----------
...
1,775
Posted By mmab
Thanks for your reply, that worked! I'll need to...
Thanks for your reply, that worked! I'll need to brush up on my syntax!!
1,775
Posted By mmab
Loop through usernames 1 by 1 and select
Hello All,

A quick description of what I would like to do;

1) Find all the current registered usernames and loop through them.
2) Display each username 1 by 1 and Ask the user if they would...
1,903
Posted By mmab
just tested it again, it works! Think I may have...
just tested it again, it works! Think I may have been putting in a rogue character.
Thanks

---------- Post updated 11-11-11 at 10:39 AM ---------- Previous update was 10-11-11 at 05:13 PM...
1,903
Posted By mmab
Tried the code but it now just outputs all the...
Tried the code but it now just outputs all the subdirectories in the main directory, regardless of the search criteria.
1,903
Posted By mmab
thanks for the quick response. I tried your...
thanks for the quick response. I tried your method but got '-printf is not a valid option'. I tried it using just 'print' and got 'There is a missing conjunction'
1,903
Posted By mmab
List directory name (only once) after multiple file extensions found
Here is a simplified example of my problem. Say I have the following 3 sub-directories;

./folder1
A.txt
A.sh

./folder2
B.txt

./folder3
C.txt
C.sh

I would like to list the...
11,864
Posted By mmab
thanks for the reply. That works! Appreciated.
thanks for the reply. That works!
Appreciated.
11,864
Posted By mmab
Longest length of string in array
I would be grateful if someone could help me. I am trying to write a .sh script in UNIX.

I have the following code;

User[0]=john
User[1]=james
User[2]=ian
User[3]=martin

for x in...
Showing results 1 to 22 of 22

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