Search Results

Search: Posts Made By: Tr0cken
1,411
Posted By Tr0cken
Assigning fields values to different variables
Hi,

I have this code:

cat file.txt | awk -F, 'NR==1{print $6","$8","$10","$20","$21","$19}' > file.tmp
VAR1=`cat file.tmp | cut -d "," -f1`
VAR2=`cat file.tmp | cut -d "," -f2`
...
4,093
Posted By Tr0cken
Thank you guys!
Thank you guys!
4,093
Posted By Tr0cken
awk and leading zeroes
I have the following script that renames filenames like:
blah_bleh_91_2011-09-26_00.05.43AM.xls
and transforms it in:
91_20110926_000543_3_blih.xls

for a in *.xls;
do
b="$(echo "${a}" | cut...
1,867
Posted By Tr0cken
Adding the field separator worked like a charm. ...
Adding the field separator worked like a charm.

Thank you.
1,867
Posted By Tr0cken
Split a file with awk
Hi!

I have a file like this:
a,b,c,12,d,e
a,b,c,13,d,e
a,b,c,14,d,e
a,b,c,15,d,e
a,b,c,16,d,e
a,b,c,17,d,e

I need to split that file in two:
If field 4 is equal or higher than 14 that...
1,587
Posted By Tr0cken
Maybe I've been unclear. Consider a file...
Maybe I've been unclear. Consider a file containing the following lines:

1,2,3,4,5,a,7,b,9,d
1,2,3,4,5,a,7,b,9,d
1,2,3,4,5,a,7,b,9,d
1,2,3,4,5,d,7,b,9,a
1,2,3,4,5,d,7,b,9,a

First three rows...
1,587
Posted By Tr0cken
Sort and output to different files
Hi all! I have a comma delimited file and I'm sorting it based on fields 6, 8 and 10. The following does the job:
sort -t, -nk6,10 unsorted.txt -o sorted.txt

What I need to do now is to write...
Forum: Red Hat 06-03-2011
8,699
Posted By Tr0cken
Loggin SFTP activity for chrooted (rssh) users
Hi, I need to log the activity of my SFTP (RHEL 5.4).

I have this in /etc/sshd/sshd_config:
Subsystem sftp /usr/libexec/openssh/sftp-server -f LOCAL5 -l VERBOSE

And this in...
2,785
Posted By Tr0cken
Password encryption...
Hi, I have a Java app that looks for some parameters in a .properties file such as username and password. However I don't want to leave the password in a text file and I can't modify the app...
...
2,507
Posted By Tr0cken
Concurrent execution
Hi all,

I have a folder with sql files that need to be inserted in a DB with SQL*Plus. The thing is that it takes too long to insert them all one by one, so I want to insert them five at a time....
2,168
Posted By Tr0cken
I have another twist with this, I need to add a...
I have another twist with this, I need to add a number to a field. For example:

awk -F, '
...
$25 == "71" && $26== "119" {$25="19"; $13=99$13; f=1}
{print; f=0}


If $13 original value in...
2,168
Posted By Tr0cken
Now it works like a charm. Thank you very much!
Now it works like a charm. Thank you very much!
2,168
Posted By Tr0cken
It seems to be a very clever solution, however it...
It seems to be a very clever solution, however it did not work. $4 does not change its value to "99"...
2,168
Posted By Tr0cken
That worked very well, however I need that if...
That worked very well, however I need that if none of the checks are met, $4="99". Can this be done?
2,168
Posted By Tr0cken
Replacing fields
Hi!

I have a file somefile.txt:
12, 1, a, b, c, d, e, f
12, 1, a, b, c, d, e, f
17, 51, a, b, c, d, e, f
...
I've made this script to read two fields from a line and output a third:
cat ...
6,525
Posted By Tr0cken
if-then with awk
Hi, what I'm trying to do is to read a couple of fields from a file with awk and if the conditions are met asign a value to a variable:

awk '{if ($1 == "xx" && $2 == "yy") VARIABLE="zz" }' file
...
1,238
Posted By Tr0cken
Thank you!
Thank you!
1,238
Posted By Tr0cken
Input and value problem
Hi, I need to convert given cents to dollars so I have a script with this this:

A=$(echo "$1*0.01" | bc)
echo $A

B=$(echo "$2*0.01" | bc)
echo $B

C=$(echo "$3*0.01" | bc)
echo $C
...
1,346
Posted By Tr0cken
This did the trick. Thank you very much!
This did the trick.

Thank you very much!
1,346
Posted By Tr0cken
Take always the last x fields
Hi,

I have a bash script that converts .csv files to sql inserts and so far has worked great. It takes the values and does it's magic.
The thing is that now the .csv files have fields that I...
8,619
Posted By Tr0cken
This one works and runs very fast! Thanks.
This one works and runs very fast! Thanks.
8,619
Posted By Tr0cken
This also gives me the same number for all the...
This also gives me the same number for all the lines! I need a different number for each line.
8,619
Posted By Tr0cken
Excelent solution. Thank you!
Excelent solution. Thank you!
8,619
Posted By Tr0cken
Sed and random
Hi everyone, this is my first post.
Some time ago I did a script to convert .csv files to oracle inserts. Now I need to add something and I can't make it work. This is the code:

#!/bin/bash...
Showing results 1 to 24 of 24

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