Multiplying lines of file that contain certain letter by value
I am trying to remove the last letter in a file and then multiply each line (which contained this letter) by 500. This is what I have:
This removes the A but then I can not multiply the lines that had the A with 500.
I was able to pass the file through a variable - var
and it will find the A, but I am not sure how to multiply the lines that had the A by 500. I don't want any of the other lines multiplied.
Does someone have a suggestion?
This is what I need:
1. find lines with A and delete the A - which is always at the end of file
2. then multiply those lines only by 500
3. The rest of the lines that don't contain the A should not be multiplied.
Last edited by Scrutinizer; 04-06-2015 at 02:21 PM..
Reason: Additional code tags for data sample
Dear friends,
i am writing csh script
i have one dat file containing following data.like this.
08FD3 03A26 000FA0 FFFF0 BBA0F 00000 00000
from the above file i want to read each letter and store it in one variable.
how it is possible.
please help (7 Replies)
How can I delete those lines that starts with a certain letter?
abc def ghi
xyz abc def
ace gik moq
abe imq gxm
I want to delete the line that starts with "x". Thanks! (4 Replies)
Hi ,,
i have the below file...
D 2342135
B 214236
C argjlksd
V lskjrghaklsr
C slkrgj
B sdg4tsd
E aslkgjlkasg
i want to sort the lines into different files based on the starting letter of the line. so that i have different files for lines starting with a letter.
thanks (1 Reply)
Hi im a noob in Unix
Do you guys know what command display you the files that have the character n in there name im not looking that they have the n in the beginning or in the end im looking that in search the entire string to see if it have the character n i try this
ls n*
but only show... (2 Replies)
the title is self explanatory
I assume awk and sed existence to do the job but i'm really not good in pattern space comprehension to make it so
I wanna pick the first letter of each line in a file, what's the way ?
Thanks a lot (9 Replies)
Hi,
I have lets say 10 files , I need to process them one by one.
So I need a command to get one file name at a time to process it into a variable
Example
Files
P1111.dat
P3344.dat
S344.dat
...
v_file_name = 'p111.dat' .. I will rename it to something after processing
... (1 Reply)
Write a program which asks user to enter a string and that string saves in a .txt file. After the file has been saved your program must count how many time letter 'a' has been reapeated ?
Use fstream, string, and cctype libraries to make your jobe easier.
I wrote following code
#include... (1 Reply)
Hi, I am trying to multiply column#1 with column#2 using a shell script. How can I make a for-loop script using 1st column as "i" and the second column as "j" from the following file? Please feel free to share any alternative ways to multiplying column#1 with column#2.
.06 5.0000
.49 ... (6 Replies)
Good afternoon all,
I want to ask how to change some letter in my file with other letter in spesific line
eg.
data.txt
1
1
1
0
0
0
0
for example i want to change the 4th line with character 1.
How could I do it by SED or AWK.
I have tried to run this code but actually did not... (3 Replies)
Discussion started by: weslyarfan
3 Replies
LEARN ABOUT OSX
towupper_l
TOWUPPER(3) BSD Library Functions Manual TOWUPPER(3)NAME
towupper, towupper_l -- lower case to upper case letter conversion (wide character version)
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <wctype.h>
wint_t
towupper(wint_t wc);
#include <wctype.h>
#include <xlocale.h>
wint_t
towupper_l(wint_t wc, locale_t loc);
DESCRIPTION
The towupper() function converts a lower-case letter to the corresponding upper-case letter.
Although the towupper() function uses the current locale, the towupper_l() function may be passed a locale directly. See xlocale(3) for more
information.
RETURN VALUES
If the argument is a lower-case letter, the towupper() function returns the corresponding upper-case letter if there is one; otherwise, the
argument is returned unchanged.
SEE ALSO iswupper(3), toupper(3), towlower(3), wctrans(3), xlocale(3)STANDARDS
The towupper() function conforms to ISO/IEC 9899:1999 (``ISO C99'').
BSD October 3, 2002 BSD