各位大佬,目前有类似这样的文件:import 和from 可能在一行,也可能不在一行,是多行
import React, {Component} from 'react';
import {
Platform,
StyleSheet,
Text,
View,
FlatList,
TouchableHighlight,
DeviceEventEmitter,
Animated,
BackHandler
} from 'react-native';
import {
UPTrackEvent
} from' up-rn-base/action/UPModules'
import {
kkjhhhhh,
jhhjjhhhh,
kkkkkk
} from 'up-rn-base/action/UPModules'
import {oooooo} from 'up-rn-base/action/UPModules'
import {ppppp} from 'up-rn-base/action/UPModules'
import OrderBar from '../views/OrderBar'
import OrderList from '../views/OrderList'
import OrderUtils from '../views/OrderUtils'
import ViewLoading from "up-rn-base/views/LoadingComponent"
import FailureComponent from "up-rn-base/views/FailureComponent"
import UPReactTitle from 'up-rn-base/views/UPNativeTitle'
import RNText from 'up-rn-base/component/UPWRNText'
import UPMultiLanguageConfig from '../config/UPMultiLanguageConfig'
let dimensions = require("Dimensions");
let {width, height} = dimensions.get("window");
const BAR_HEIGHT = 42;
export default class List extends Component {
我想提取出from后是up-rn-base路径及对应的import 和from 之间的内容,最后提取的结果类似这样:
UPTrackEvent up-rn-base/action/UPModules
kkjhhhhh up-rn-base/action/UPModules
jhhjjhhhh up-rn-base/action/UPModules
kkkkkk up-rn-base/action/UPModules
oooooo up-rn-base/action/UPModules
ppppp up-rn-base/action/UPModules
ViewLoading up-rn-base/views/LoadingComponent
FailureComponent up-rn-base/views/FailureComponent
UPReactTitle up-rn-base/views/UPNativeTitle
RNText up-rn-base/component/UPWRNText
目前用了
awk '/import/,/from/{print $0}'
只能到这个结果:
import {
Platform,
StyleSheet,
Text,
View,
FlatList,
TouchableHighlight,
DeviceEventEmitter,
Animated,
BackHandler
} from 'react-native';
import {
UPTrackEvent
} from' up-rn-base/action/UPModules'
import {
kkjhhhhh,
jhhjjhhhh,
kkkkkk
} from 'up-rn-base/action/UPModules'
import {oooooo} from 'up-rn-base/action/UPModules'
import {ppppp} from 'up-rn-base/action/UPModules'
import OrderBar from '../views/OrderBar'
import OrderList from '../views/OrderList'
import OrderUtils from '../views/OrderUtils'
import ViewLoading from "up-rn-base/views/LoadingComponent"
import FailureComponent from "up-rn-base/views/FailureComponent"
import UPReactTitle from 'up-rn-base/views/UPNativeTitle'
import RNText from 'up-rn-base/component/UPWRNText'
import UPMultiLanguageConfig from '../config/UPMultiLanguageConfig'
网上搜了,及看了多行匹配相关的内容,还是搞不出来。
目前想着把相邻的import from 整成一行再提取。
恳请大佬,根据关键字对行合并成一行怎么写呢,或者怎么能的呆我想要的结果呢。非常感谢。