03-20-2007
read string, check string length and cut
Hello All,
Plz help me with:
I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it is.
Example:
csv file:
1,Test Name,"This is a test and is funny",,,1234
Value1: max(10)
Value2: max(8)
Value3: max(21)
Value4: max(5)
Value5: max(5)
Value6: max(5)
and the expected result is:
1,Test Nam,This is a test and is,,,1234
Plz help!
Thnx in advance!
~Ozzy
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys, I hope you can help me with my problem.
I have a text file that contains lines like this:
78 ANGELO -809.05
79 ANGELO2 -5,000.06
I need to find all occurences of amounts that are negative and replace them with x's
78 ANGELO xxxxxxx
79... (4 Replies)
Discussion started by: amangeles
4 Replies
2. Shell Programming and Scripting
#!/usr/bin/ksh
exec 0<property
while read newReceiveDir
do
if
then
sed -e 's//home/joshua/bodi/data/receive/{$newReceiveDir:25}/g/' mp_validate.sh >| mp_validate.sh
elif
then
sed -e 's//home/joshua/bodi/data/temp/{$newReceiveDir:22}/g/' mp_validate.sh >| mp_validate.sh ... (1 Reply)
Discussion started by: joshuaduan
1 Replies
3. UNIX for Dummies Questions & Answers
HI
In my script, i am reading the input from the user and want to find the length of the string.
The input may contain leading spaces. Right now, when leading spaces are there, they are not counted.
Kindly help me
My script is like below. I am using the ksh.
#!/usr/bin/ksh
echo... (2 Replies)
Discussion started by: dayamatrix
2 Replies
4. Shell Programming and Scripting
now I have a string
.a/b/c/done
I want to get "done" from it. That is the result should be "done"
sorry for my language before.
Thanks in advance (5 Replies)
Discussion started by: Henryyy
5 Replies
5. Shell Programming and Scripting
I need a script that will run in unix to:
1) Read and input file with 1 column that contains for ex:
0123456789
1234567890
...etc
2) Checks the first column if it is:
a. Numeric from 0 - 9
b. if it is not less... (4 Replies)
Discussion started by: mrn6430
4 Replies
6. Shell Programming and Scripting
I want to append file with a string but before doing that i want to check if this string already exist in that file.I tried with grep on Solaris 10 but unsuccessful.Man pages from grep seems to suggest if the string is found command status will be 0 and if not 1.But i am not finding it.May be i... (2 Replies)
Discussion started by: sahil_shine
2 Replies
7. UNIX for Dummies Questions & Answers
I need to check 1 log file, which is logging:
2014-08-18T09:10:39+02:00 user: XXXXX START FEATURE
2014-08-18T09:10:39+02:00 user: XXXXX FINISH FEATURE
I first need to check that the START FEATURE starts and finish on the same time/date for the same user, which is different each time START... (2 Replies)
Discussion started by: TheBest43
2 Replies
8. Shell Programming and Scripting
Hi all, the value in the following file is just an example. It could be a different value/network addresses.
Here is my example of initial output in a file name net.txt
Initial Output, net.txt
The goal is to produce the following format which is to convert from CIDR to Netmask... (6 Replies)
Discussion started by: type8code0
6 Replies
9. Shell Programming and Scripting
Hi all,
I am currently trying to figure out how can i capture a particular string from a log file, then search again but from the last line it read before onward.
Basically let's say that the check runs every 5 mins via cron, counting the number of matched strings "Cannot assign requested... (5 Replies)
Discussion started by: nms
5 Replies