Search Results

Search: Posts Made By: apenkov
2,436
Posted By apenkov
Problem with awk print
Hello,
I have a file like

When I try to print all strings

I get that output

How can I get

Could you please help. Thanks !
4,477
Posted By apenkov
Comparing file names with different extensions
Hello, I need some help. I have files in one and the same directory, but with different extensions, like this:

file1.IN
file2.IN
file3.IN
file1.OUT
file2.OUT

Apparently some files with OUT...
21,972
Posted By apenkov
Hi, At the end I did it with substr while...
Hi,
At the end I did it with substr

while read string
do
str1=${string:0:5}
str2=${string:5:2}
str3=${string:7:4}
str4=${string:11:7}
str5=${string:18:2}
done < input.txt

But the 2...
21,972
Posted By apenkov
OK, Sorry. Here are the length of the fileds ...
OK, Sorry. Here are the length of the fileds

str1=5
str2=2
str3=4
str4=7
str5=2
21,972
Posted By apenkov
Split string by position
Hello,
I have a file, where the strings in the lines are with fixed length. Like this

1234ABXX234ABC123456

And I want to split that line as it is colored. The output to be like this:
...
2,262
Posted By apenkov
Ohhhh.....always forget that part...
Ohhhh.....always forget that part /usr/xpg4/bin/awk
It works. Thanks a lot guys!
2,262
Posted By apenkov
Hi, Thanks for prompt replies. When I add...
Hi,
Thanks for prompt replies.
When I add that part:

$27=$27?$27:"default_value";

I get an error:

awk: syntax error near line 1
awk: illegal statement near line 1

Input below:
...
2,262
Posted By apenkov
awk if else within 1 line
Hello,
I get data from an input file and write it to an output like this:

cat CATA.csv|sed 's/"//g'|egrep '|XHA|CCD|DDD'|awk '{print...
954
Posted By apenkov
1,346
Posted By apenkov
Thank you all!
Thank you all!
1,346
Posted By apenkov
Problem with blanks, shifting the row when using awk
Hello,
I have files with fixed length fields.

12345 12345 12345671234567 10 1234567
12345 12345 123456 1234567 10 1234567

I want to take 1st, 3rd,...
1,071
Posted By apenkov
Thank you very much Radoulov, it works perfectly!
Thank you very much Radoulov, it works perfectly!
1,071
Posted By apenkov
Appending lines in a file
Hello,
I have a file like:

str1,"HEX"H,(39),info
str2,"HEX"H,(854548),info
str3,"HEX"H,'BGTOUR',info
str4,"HEX"H,(534322),info
str1,"HEX"H,,info
str3,"HEX"H,'Landing',info...
1,726
Posted By apenkov
I am really, really sorry. It turns out that the...
I am really, really sorry. It turns out that the lines of the file are ending with ^M, I saw it when I opened with vi. I removed it and it works. What a stupid mistake....and it is not the first time...
1,726
Posted By apenkov
Tried it, the same thing. Always starts with str1...
Tried it, the same thing. Always starts with str1 and then a couple of strings, ending the line without comma...like that:

str1,str1,val3,str2,val4,val5,str3,val22...
1,726
Posted By apenkov
I receive on every row 28 strings and the row is...
I receive on every row 28 strings and the row is ending without comma.
Like that:
...
1,726
Posted By apenkov
It is not working properly. It displays strange...
It is not working properly. It displays strange things. E.g.

str1,val2,val3,str2,val4,val5,str3,val22,val33 ,str4,val44,val55,str5,val6,val7,str6,val77,val88,str7,val99,val00,ex

red = missing...
1,726
Posted By apenkov
OK, that seems to be nice. But how can I figure...
OK, that seems to be nice. But how can I figure out the new line, because it displays everything in a row now.
Thanks a lot!
1,726
Posted By apenkov
Columns to rows
Hi,
I have a big file, with thousands of rows, and I want to put every 7 rows in a line. Input file:

str1, val2, val3
str2, val4, val5
str3, val22, val33
str4, val44, val55
str5, val6, val7...
2,519
Posted By apenkov
Thanks a lot RudiC! ---------- Post updated...
Thanks a lot RudiC!

---------- Post updated at 10:41 PM ---------- Previous update was at 10:39 PM ----------



I'm getting syntax error, will try to figure it out. Thanks!
2,519
Posted By apenkov
Trying this I get: bash: command...
Trying this I get:

bash: command substitution: line 1: syntax error near unexpected token `^1'
bash: command substitution: line 1: `egrep(^1|3) file.txt | sed 's/ /,/''


---------- Post...
2,519
Posted By apenkov
Get number of lines after certain string
Hello people,
I have a file like that:

start something
1 xxx yyy
2 zzz xxx
3 ccc vvv
4 mmm nnn
stop something
1 aaa bbb
2 ccc ddd
3 eee fff
4 qqq www
start something
1 rrr ttt
2 yyy...
1,662
Posted By apenkov
Thanks guys!!!
Thanks guys!!!
1,662
Posted By apenkov
Rename more than 1 file
Hi, I have multiple files in a directory e.g.

file1.txt.gz
file2.txt.gz
file3.txt.gz

and I want to rename them to:

file1.dat.gz
file2.dat.gz
file3.dat.gz

I don't have 'rename' command...
1,770
Posted By apenkov
Yes, /usr/xpg4/bin/awk is working. Thanks all!
Yes, /usr/xpg4/bin/awk is working.
Thanks all!
Showing results 1 to 25 of 70

 
All times are GMT -4. The time now is 08:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy