Search Results

Search: Posts Made By: littlewenwen
2,682
Posted By littlewenwen
Thank you all for help!
Thank you all for help!
2,682
Posted By littlewenwen
Create multiple files
dear all

suppose I have two files file_000 and file_id:

file_000:
blablablabla000blablabla000
000blahblah000blahblah
blah000blahblahfile_id:
001
002
003now, based on file_id, I want to...
1,232
Posted By littlewenwen
Wow, I got solutions in shell, awk and perl! ...
Wow, I got solutions in shell, awk and perl!
Thank you all very much!
1,232
Posted By littlewenwen
How to selectively NOT output some fileds?
Dear All

I have a text file which has many columns (>10,000). I want to create a new text file which will NOT include following columns: 5,15,105,200. How can I do that in shell (or awk, perl)?...
1,126
Posted By littlewenwen
Thank you very much for spending time helping me.
Thank you very much for spending time helping me.
1,126
Posted By littlewenwen
Thank you very much for help. Corona688,...
Thank you very much for help.

Corona688, could you explain a bit more about string3,

string3="${string1##*${string2}}"

what does the ##* do here? where can I find an introduction of their...
1,126
Posted By littlewenwen
Strange result
Hi,

I have following codes which looks ok:


$ string1="123456789 abc2"
$ string2="abc"
$ position_of_string2=`expr index "$string1" "$string2"`
$ echo $position_of_string2
$
11however,...
3,275
Posted By littlewenwen
Thank you very much.
Thank you very much.
3,275
Posted By littlewenwen
Thank you very much for educating me. Now...
Thank you very much for educating me.

Now suppose I have following codes:

$ var999=abc$'\n'def$'\n'defabc$'\n'def$'\n'def
$ echo "$var999"
abc
def
defabc
def
def
$

var999 has several...
3,275
Posted By littlewenwen
How to remove new line from variable?
I have following codes:

~$ var_1="ABC"
~$ echo $var_1 | wc -m
4
~$ echo -n $var_1 | wc -m
3
~$ var_2=`echo -n $var_1`
~$ echo $var_2
ABC
~$ echo $var_2 | wc -m
4
~$

I would suppose...
4,369
Posted By littlewenwen
Thank you very much for help, really appreciate...
Thank you very much for help, really appreciate it.
4,369
Posted By littlewenwen
Thank you so much for helping me. I am sorry...
Thank you so much for helping me.

I am sorry to ask you so many questions; but I am just wondering what if I only want to read the 2nd filed? maybe with combined use of "cut" command? such as
...
4,369
Posted By littlewenwen
Thank you very much. What if my file is...
Thank you very much.

What if my file is delimited by "|" or";"? can shell read fields of such files into array variables?
4,369
Posted By littlewenwen
Pass awk array variable to shell
Hi, all

suppose I have following myfile (delimited by tab)

aa bb
cc dd
ee ffand I have following awk command:

awk 'BEGIN{FS="\t"}{AwkArrayVar_1[x++]=$1;AwkArrayVar_2[y++]=$2};END{for(i=0;...
1,515
Posted By littlewenwen
Thank you. Is there any word anchor for AWK?
Thank you.
Is there any word anchor for AWK?
1,515
Posted By littlewenwen
What is the most widely used word anchor used in Regex?
Hello, All

I learned from book about word anchor "\<" and "\>"; however when I tested them, they seem to work only in grep.

Can anyone suggest word anchor that can be used in grep, awk, perl...
5,579
Posted By littlewenwen
What is the equivalent of NR (awk) in perl?
Hello,

I searched online; it seems that perl use $NR as NR in awk; however it does not work for me. For example, how to re-write the following awk using perl:

awk '{ print NR}'...
13,941
Posted By littlewenwen
Thank you very much!
Thank you very much!
13,941
Posted By littlewenwen
How to reference 2 dimensional array in awk?
Hello, all

For a 1-dimensional array, such as
myarr_1[AA]=1
myarr_1[BB]=2
myarr_1[CC]=3I know I can write a loop as below to show the array member one by one:
for (i in myarr_1){print i,...
1,594
Posted By littlewenwen
Thank you very much.
Thank you very much.
1,594
Posted By littlewenwen
Thank you very much. By the way, can perl...
Thank you very much.

By the way, can perl update the field value in place? thanks.
1,594
Posted By littlewenwen
How to update field value in place?
Dear all:

I have a file:
1:00 2:abc 3:12asweand I ran the following awk script on this file:

#!/usr/bin/awk -f
{ i= 1;
while(i<=NF) {
$i=substr($i, 1, index($i,...
1,252
Posted By littlewenwen
Thank you very much! I followed your methods;...
Thank you very much!
I followed your methods; and all of them work perfectly! Thank you so much!
1,252
Posted By littlewenwen
What is wrong with my script?
Dear All

The following is part of my script:


echo ${myarray[j]}
mytitle=`awk '{print substr(${myarray[j]}, 0, length(${myarray[j]})-4)}' /dev/null`
the echo ${myarray[j]} works fine;
...
7,364
Posted By littlewenwen
Thank you for reply. Maybe I did not explain...
Thank you for reply.

Maybe I did not explain clearly: what I mean "from right to left" is, for example :

string = "0123456789"

if we want to get "567", we can do by starting from "5", then...
Showing results 1 to 25 of 44

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