Search Results

Search: Posts Made By: madrazzii
6,365
Posted By tukuyomi
Thanks Corona688 for your input ! Here is...
Thanks Corona688 for your input !
Here is another solution using AWK:
~/unix.com$ awk '{gsub("\r","");print > "file"$NF".txt"}' RAW
6,365
Posted By Chubler_XL
You could also just have awk ignore the extra...
You could also just have awk ignore the extra char on the end like this:

awk '{print > "file.txt" susbtr($0,length-2,2) }' RAW
6,365
Posted By Corona688
tr does not work that way. It deals with...
tr does not work that way. It deals with individual characters, not strings. Since you gave it two characters on the input, it's expecting 2 characters on the output, too.

This should work:
...
6,365
Posted By tukuyomi
awk '{print > "file"$NF".txt"}'...
awk '{print > "file"$NF".txt"}' RAW
6,365
Posted By Chubler_XL
I'f you know you only have a few different record...
I'f you know you only have a few different record types you could try something like this:

awk '{ print > "file." substr($0,length-1) }' RAW


otherwise try
awk '
/T0$/ { print > "file1" ;...
6,365
Posted By tukuyomi
awk '{print > $3".txt"}' EDIT.txt awk...
awk '{print > $3".txt"}' EDIT.txt

awk '{print > $NF".txt"}' RAW
6,365
Posted By rbatte1
To stick with the two command approach, you would...
To stick with the two command approach, you would be better with:-grep "procedures" > procedures.txt
grep -v "procedures" > codes.txt



Robin
6,365
Posted By rveri
Hi madrazzii, Check this out: awk...
Hi madrazzii,
Check this out:
awk '{if($0~/PROCEDURES/) print >"PROCEDURES.TXT" ; if ($0~/CODES/) print >"CODES.txt" }' EDIT.txt
6,365
Posted By Chubler_XL
Using awk: awk '/PROCEDURES/ { print >...
Using awk:

awk '/PROCEDURES/ { print > "PROCEDURES.TXT"; next} { print > "CODES.TXT" }' infile
3,101
Posted By RudiC
Then extend bipinajith's script to look like awk...
Then extend bipinajith's script to look like awk '{ print substr($0,1,218) "\r"; }' ...
3,101
Posted By RudiC
I think you have (windows?) control chars (esp....
I think you have (windows?) control chars (esp. <CR> = carriage return = ^M = 0x0D) in your file, making subsequent lines overwrite earlier lines. Give it a shot after removing those... (tr -d '\r'...
3,101
Posted By Yoda
Try cut -c 1-218 INP_psf1301.txt >...
Try
cut -c 1-218 INP_psf1301.txt > outputfile.txt
OR
awk '{ print substr($0,1,218); } ' INP_psf1301.txt > outputfile.txt
Showing results 1 to 12 of 12

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