Hello!
I started how to write scripts (basic one) in bash. I would like to post my problems here (i will edit topic if i will have any news problems)
1] i have a txt file like:
...
first column is ,,id" and second is evaluation i would like to replace numbers :
A-0, B-1... and after that i would like to write changed coulumn 1 and column 2
change my first column and save result in variable how can i display it now?
Moderator's Comments:
Please use CODE tags for sample input and output as well as for sample code segments.
Last edited by Don Cragun; 02-04-2015 at 10:25 PM..
Reason: Add CODE tags.
yes but u changed 2nd column too and its not good. I want to change only 1st column example display should be:
Moderator's Comments:
Please use CODE tags for sample input and output as well as for sample code.
With the translation table you provided, how would you ever get the output shown above from the input you provided in the 1st post in this thread:
To get AABDA you would need to start with 00130, not 32323 or 12121.
If you want some decent error checking in place, you can't do it in one line. Nor if you want your code to be legible (for yourself as well as for others).
For just the translation, try
---------- Post updated at 08:36 ---------- Previous update was at 08:31 ----------
BTW, gawk "{print}" $file is an enormous effort for just catting that file, which in turn were useless as well as you can read the redirected file...
Of course it could also be written using a single call to awk, but it isn't nearly as compact as a shell for loop calling tr:
which could also be written on a single line as:
but I MUCH prefer readable to "fits" on a single line.
If you want to try either of these on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk.
In the future, when you present more scripts, please show us samples of the data you have, the data you want, and the code you have tried as well as a description of the processing to be performed. Since extensions to the "standard" utilities vary from system to system and shell to shell, please also tell us what operating system and shell you're using.
i have windows 8 host on Dell Laptop
vmware 9
redhat 7.2 iso downloaded through redhat official site
after installation on vm it only boots into text dont show graphics
Please guide:( (1 Reply)
I am experimenting with some scripting as a way to learn more about it. I have a simple script that calls two other scripts. Each script echos some stuff to prove it ran and then sets a simple variable and exports it.
I cannot get one of the variables to display back in the main calling script... (2 Replies)
I am facing a problem and I would be grateful if you can help me :wall:
I have a list of words like
And I have a datafile like
the box of
the box of tissues out of
of tissues out of
the book, the
the book, the pen and the
the pen and the
I want to find Patterns of “x.*x” where... (2 Replies)
Could anyone explain why I am having trouble surfing the internet with both firefox and konqueror? Chromium seems to be the only browser that will work. I tried to create a new profile with firefox and that didn't work either. I can ping things just fine, I can download stuff with wget, I can ssh... (6 Replies)
Hello, I have a block of code (XML) that I would like to grep for certain information. The basic format of the XML is the following repeated a few hundred times, each time with a unique ID:
<Identifier ID="A" NAME="John Doe" AGE="32 Years" FAMILY="4" SEX="MALE"></Identfier>
I would like to... (6 Replies)
I need to write a script to test a nsort c program. I have written 8 .txt files with different cases. Also 8 .txt files with expected outcome. The shell I have written always "test pass" for the first case but always "fail" for the rest... Here is a portion of my code (as I still don't know how to... (5 Replies)
Hey Guys,
I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at... (1 Reply)
hi guys,
i have a DEl xps laptop cor 2 duo 2.2
i have vista installed on it
i want to install a dual Boot UNIX on it..
can some one guide me ...cause i m tottaly new to UNIX
i want to install unix on that laptop along with Vista....
thx
any help would be deeply appreciated
(sorry if i... (5 Replies)
Recently installed a custom PC with Solaris 10 u4, kernelpatch 127112-10.
I was going to use this box as a NAT router using ipf. ipf however caused the box to panic multiple times. This in turn lead to a couple other issues that I would like some input of.
- None of the panic's i've... (0 Replies)
Anyone know where I can get started in C++ programming in unix?
Any good free tutorials or websites to start at?
I am okay in unix scripting but have never done c programming of any sort...
What are the main advantages of using C++ ? (2 Replies)