Hello, i have a few questions which i hope you guys can address. the 1st prob:
The database i am using is a text file which displays the information like this :
Title : Quantity : Price
Persia : 30 : 20
Australia : 40 : 20
What i am trying to do is that when it searches,both the information must be the same , then it will come out the output "A". For example, if i input "Persia" into Title and "20" into Price , only then will it display the output"A". When i ran this, an error like the one below came out.
what is the problem with this and how do i solve it?
2nd problem : how can i make sure that when it searches for the information, it is from the correct row? as you can see from the database, both books have the same price.
3rd) After searching and getting the right row , how do i delete it?
You were missing your grep command after the pipe, so the shell was trying to find a command called "-q20" and so it gave the error.
Also you should remove the first "-q" so that the output passes through the pipe for the next grep.
This will help the first problem but you will run into issues if you search for a $Price that equals the Quantity value. You will have to use awk or cut to check the position of the value to make sure you found the correct entry.
O could you give some guidance on how the awk code be like when I try to retreive data? For example when I search for apple, how do I get it to display all the information such as price and quantity?
Hi all,
I'm excited to the part of unix.com forum, and noob to it.
I have an query, where I have an file and it contains data like this
use
thread
when
posting
do
no
I was expecting the result as
use thread
thread when
when posting
posting do
do no
use thread when
thread when... (6 Replies)
Hi All,
I need the command to join 2 lines into one. I found lots of threads but none give me the sollution. Probably because unix scripting is one of my best features ;)
I got a logfile where line 2 needs to be joined with line 1, lines 4 needs to be joined with line 3 etc
If you need... (16 Replies)
Hi ,
I want to join two lines in a file, where the second line contain query string. if it doesn't contain that string i don't want to join
e.g.
Input file is as following:
name fame game
none none none
name fame game
cat eat mice
I need output file as
name fame game
none none... (2 Replies)
Hi,
Whats the unix function to join multiple files? is it cat?
so I have multiple files in the same format and I want to join then by row
eg.
FILE1
1 3
1 3
1 3
1 3
FILE2
2 4
2 4
2 4 (1 Reply)
Hi Everyone,
Thanks in advance for what is hopefully a simple thing.
Big picture I am trying to bind computers to AD using their existing name but add a suffix.
Here is the part I am having trouble with:
computername=`/usr/sbin/scutil --get LocalHostName`
suffix=suffix... (2 Replies)
I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config.
I am not sure if I can do this with BASH scripting.
I have set up password less login by adding my public key to authorized_keys file, it works.
I am a little... (1 Reply)
Hello all,
i've written a small piece of code that will read commands from standard input and executes the commands.
Its working fine and is execting the commands well. Accepting arguments too. e.g
#mkdir <name of the directory>
The problem is that its not letting me change the directory i.e... (4 Replies)
Hi,
Could anyone help me ?
I'm trying to join two files, but no common field are on them. So I think on generate \000\ sequence to add for each line on both files, so then will be able to join these files.
Any idea?
Thanks in advance, (2 Replies)