10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a number of files in the /tmp directory with PET-DOG in their name. I want to delete them, leaving only files with PET-CAT and PET-HORSE. I'd like to use the find command to locate those files (by using a variable) and then I'd like to delete them. However, I can't find a way to do this. I... (3 Replies)
Discussion started by: newbie2010
3 Replies
2. UNIX for Dummies Questions & Answers
#!/bin/sh
I have a file matrix.pair.cols that contains numbers like shown below:
case1 17 18
case2 1 2
case3 4 5
case4 .. ..
I want to cut the column numbers mentioned in col2 and 3 from another file
I have tried the code below, but no avail.
#!/bin/sh
while read p q r
do... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies
3. Shell Programming and Scripting
How can I accomplish this? I basically want to merge two variables onto the same line. I can do it with two FILES this way:
$ cat /tmp/users_in.list | awk -F "," '{print $2}' | cut -c -1 > first.initial
$ awk -F "," '{print $1}' /tmp/users_in.list | awk '{print $1}' > last.name
$ paste... (5 Replies)
Discussion started by: greenlightening
5 Replies
4. Shell Programming and Scripting
I am scripting a process where usernames are added to the end of a specific line in a file.
using this:
awk 'NR==1{$NF=$NF" TEXT"}1' myfileworks, and then I would use > tempfile && mv tempfile myfile
HOWEVER. Being that this is to be scripted, I am trying to do something like:
awk:... (8 Replies)
Discussion started by: magicjoe
8 Replies
5. UNIX for Dummies Questions & Answers
Command expansions are pretty useful in some situations, however, I am not understanding why expansions do not update files, folders, directories, or even the current time, when there are placed in variables. For example:
#create variable
d=$(date)
result
echo $d
Fri Jun 14 15:48:04... (8 Replies)
Discussion started by: BrandonD
8 Replies
6. Shell Programming and Scripting
Hi all,
I want write a script to display 5rows at times from a input file.
my out like:
echo " display started"
r1
r2
r3
r4
r5
... Some action items...
again i need next 5 lines.
can you please advise. (2 Replies)
Discussion started by: koti_rama
2 Replies
7. Shell Programming and Scripting
Hi.
I have an interesting problem and i couldn't find out the solution.
I have two variables in which there are a lot of lines finished by \n. I would like to concatenate this two variables into one in this format:
var1var2
var1var2
.
.
.
I could do this simply by command paste but it works... (32 Replies)
Discussion started by: samos
32 Replies
8. Shell Programming and Scripting
Hi ,
I have a piece of code ...wherein I need to assign the following ...
1) A command line argument to a variable
e.g origCount=ARGV
2) A unix command to a variable
e.g result=`wc -l testFile.txt`
in my awk shell script
When I do this :
print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies
9. Shell Programming and Scripting
I have the following bit of code
FOUND_SEC=`ls -ld $NAME 2>/dev/null|awk '{print $1}'`
FOUND_USER_NAME=`ls -ld $NAME 2>/dev/null|awk '{print $3}'`
FOUND_GROUP=`ls -ld $NAME 2>/dev/null|awk '{print $4}'`
is there a better way to write it to get the same result as it seems... (2 Replies)
Discussion started by: sjday
2 Replies
10. UNIX for Dummies Questions & Answers
Hi all,
I need a help.
I'm trying to do this command in a shell script:
`su -l accenture -c '/usr/bin/scp ${SCP_IN}/*.csv ${ORACLE_USER}@${ORACLE_IP}:${ORACLE_DIR}'`
but I obtain a no connection error.
If I explicit variables, It works. Why? I need use variables in this command.
... (2 Replies)
Discussion started by: idro
2 Replies